psql: FATAL: password authentication failed for user – error in Postgresql

Hi all,

I am writing after a long time. This will be a short post on the error we get in postgresql. The error is : psql: FATAL:  password authentication failed for user “username”.

The following code snippet shows the errors when password is prompted and (1) password is not supplied (2) wrong password is supplied:

manohar@manohar-desktop:~$ psql simulator
Password:
psql: fe_sendauth: no password supplied
manohar@manohar-desktop:~$ psql simulator
Password:
psql: FATAL: password authentication failed for user "manohar"

The above error is normally due to wrong password or you have not set the password for that user already. You can change the password for the user to login to the database again. You can check how to install and do the settings for postgresql in Ubuntu 12.04 here.

The following code snippet shows how to overcome the above error by changing the user’s password:

manohar@manohar-desktop:~$ sudo su - postgres
postgres@manohar-desktop:~$ psql simulator
psql (9.1.10)
Type "help" for help.


simulator=# alter user manohar with password 'newPassword';
ALTER ROLE
simulator=# \q
postgres@manohar-desktop:~$ exit
logout
manohar@manohar-desktop:~$ psql simulator
Password:
psql (9.1.10)
Type "help" for help.


simulator=#

 

 

Hope this helps you all.

Regards,
Manohar Bhattarai (मनोहर भट्टराई)
Personal Website : http://manoharbhattarai.com.np/
Personal Blog : http://blog.manoharbhattarai.com.np/

I am Manohar Bhattarai, a vivid java programmer. I am a keen Linux user. I currently boot Ubuntu Linux. I am a Free/Libre Open Source Software enthusiast.

Posted in Postgres, Ubuntu 12.04 LTS Tagged with: , , , , , , ,

Leave a Reply