Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql password cannot login

Tags:

postgresql

I typed the following instruction to set up the postgresql password.

sudo su - postgres
psql -U postgres
alter user postgres with encrypted password 'my_pass';
\q
sudo su - postgres

But I met the error.

[sudo] password for postgres:my_pass

Sorry, try again.

Which thing did I miss?

I actually set the password.

Thanks.

like image 441
Jonathan Cheng Avatar asked Oct 16 '25 17:10

Jonathan Cheng


1 Answers

to change os user password, run sequentially:

sudo su -

passwd postgres

and enter a new password.

Keep in mind that if you are a sudo user, you wont be asked for a password anyway...

like image 142
Vao Tsun Avatar answered Oct 19 '25 11:10

Vao Tsun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!