Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

psql: fatal role "root" does not exist

I have gone through many SO question answer my problem was not solved..

This is the method I tried:

user@user-Latitude-XT3:~$ sudo su postgres
No passwd entry for user 'postgres'
user@user-Latitude-XT3:~$ 

and many others.

I keep on getting fatal error user does not exist

any working solution?

please Note before marking duplicate, tried all similar but wasn't solved yet.

like image 330
Mohideen bin Mohammed Avatar asked Sep 10 '17 15:09

Mohideen bin Mohammed


2 Answers

This is how I normally login to postgres:

sudo -i
sudo -i -u postgres
psql
like image 175
theGtknerd Avatar answered Oct 11 '22 13:10

theGtknerd


Here how i fixed,

  1. vi /etc/postgresql/9.3/main/pg_hba.conf

  2. local all postgres peer

    here change peer to trust

  3. restart, sudo service postgresql restart

  4. now try, psql -U postgres

like image 25
Mohideen bin Mohammed Avatar answered Oct 11 '22 14:10

Mohideen bin Mohammed