diff --git a/docs/postgresql-setup.md b/docs/postgresql-setup.md index 9a236b8..672f01d 100644 --- a/docs/postgresql-setup.md +++ b/docs/postgresql-setup.md @@ -53,3 +53,22 @@ postgres=# SELECT version(); PostgreSQL 18.6 (Ubuntu 18.6-0ubuntu0.26.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0, 64-bit ``` +## Changing Postgres user password + +Since `PostgreSQL` runs under the `postgres` user, we need to use that user to access the database. By default, this user has no password, but by running the following command, we add a password. + +```txt +user@it2810-11:~$ sudo passwd postgres +[sudo: authenticate] Password: +Enter new password: +Retype new password: +Retype new password: +passwd: password updated successfully +user@it2810-11:~$ +``` + +Setting the password on the postgres instance itself is done with the following command + +```txt +sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'super-secret-password-that-you-cant-read';" +```