Reputation: 97
I am newbie with pgAdmin4 and here is my problem.
I setup postgresql in ubuntu, everything seems ok, I change password for the account postgres by this command sudo passwd postgres
and note it very carefully.
Then, I tried to connect to postgresql by pgAdmin4 follow this tutorial.
https://www.youtube.com/watch?v=XRdl0P4V-PU
Name is localhost Hostname is localhost Port is 5432 Maintenance database is postgres Username is postgres And password is the password I set above.
But they said to me that Unable to connect to server: FATAL: password authentication failed for user "postgres"
I tried to change the password, but still the same error. Seems something wrong ? Could you please give me some ideas ? Thank you very much.
Upvotes: 0
Views: 1490
Reputation: 10048
It seems like you only changed the password at the OS level. Basically, for the Ubuntu user postgres
, you changed the password with sudo passwd postgres
.
In order to change the password for the postgres
user for the database, you need to log into the database and change the postgres
user's password with ALTER ROLE postgres PASSWORD '<your password>';
In order to accomplish this, you will need to change your pg_hba.conf
temporarily, allowing the postgres
user to log in without a password (either set to trust
or peer
authentication method, change the password, and the switch back to password
or other authentication method). After changing pg_hba.conf
you will either want to issue a kill HUP
to the parent postgres
process (check the top-most process in your ps -ef | grep postgres
output), or simply restart postgres with systemctl restart postgresql<your_postgres_version>
Upvotes: 2