This article is half-done without your Comment! *** Please share your thoughts via Comment ***
While doing your first PostgreSQL login, Have you got an error like: password authentication failed for user “postgres”.
Relax, No problem !
This is very common error for the user of Linux PostgreSQL.
Here,You can access other related and important articles.
PostgreSQL: How to Allow Remote Connection to Connect Database
When we install PostgreSQL on Linux, by default, no any password assigns to the Postgres super user.
We should explicitly SET the postgres user password using something like below command.
1 2 3 4 |
ubuntu@:~$ sudo passwd postgres Enter new UNIX password:**** Retype new UNIX password:**** passwd: password updated successfully |
Now try to connect using postgres user:
1 2 |
ubuntu@:~$ su postgres Password:**** |
What If I forgot my Postgres user password?
If you forgot your postgres password, you can login without password by changing “md5” to “trust” in pg_hba.conf file and restart the PostgreSQL server.
After login, you can ALTER postgres user:
1 ALTER USER postgres PASSWORD 'MyNewPassword';Now again change your pg_hba.conf entry from “trust” to “md5” and restart the PostgreSQL server.