Showing posts with label psql: FATAL: Ident authentication failed for user "root". Show all posts
Showing posts with label psql: FATAL: Ident authentication failed for user "root". Show all posts

Friday, January 2, 2015

psql: FATAL: Ident authentication failed for user "root"

Postgresql error
psql: FATAL:  Ident authentication failed for user "root"

If you run command psql on terminal as root user and you get the error
psql: FATAL:  Ident authentication failed for user "root"
Here is solution for you. 

To resolve this error, Run these two commands on your terminal.
sudo -u postgres createuser root
It might give you this message
could not change directory to "/root"
Do not worry about it, when it asks
Shall the new role be a superuser? (y/n)

Enter y and press return key.

and the other command is
sudo -u postgres createdb root -O root
Now run command psql on terminal and you will log into postgresql command prompt as user root.

To check the list of postgresql databases, run command
\list

to quit the psql command prompt, run command
\q