# cat /etc/passwd|grep postgres
postgres:x:105:109:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash
// Change passwd Unix postgres user
$ sudo passwd postgres //Change Unix password of postgres user
new password:
Retype new password:
// Change authentication from peer to md5(to accept password to connect)
$ sudo vim /etc/postgresql/14/main/pg_hba.conf
#local all postgres peer
local all postgres md5
$ sudo systemctl restart postgresql
// Login to postgres using local postgres user
$ sudo -u postgres psql
postgres=#
// Change password of DB(internal user=postgres)
postgres=# ALTER USER postgres WITH PASSWORD 'NEW PASSWORD';
ALTER ROLE
postgres=# \q
// Check Login to postgres using DB's(Internal postgres user)
$ psql -U postgres -W
Password: <NEW PASSWORD>
|
// Port provided at time of installation
C:\Users\user> netstat -ant | find "5432"
TCP 0.0.0.0:5432 0.0.0.0:0 LISTENING InHost
TCP [::]:5432 [::]:0 LISTENING InHost
// During installtion postgres creates user=postgres
// password is provided during installation only
C:\Users\user> psql -U postgres
Password for user postgres:
psql (17.3)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=#
|