2

when I am trying to login to postgresql by using psql -d root -U postgres I am getting below error.

psql: FATAL:  Peer authentication failed for user "postgres"

And when typing only psql getting below error:

psql: FATAL:  no pg_hba.conf entry for host "[local]", user "root", database "root", SSL off

what I can do ? I am not able to undrstand.

Thanks in advance

0

2 Answers 2

1

You may try this: open pg_hba.conf file (/var/lib/pgsql/data/pg_hba.conf) and uncomment or add the line :

local all all trust

Then restart postgresql

# /etc/init.d/postgresql restart
Sign up to request clarification or add additional context in comments.

Comments

0

Do you try to login with user postgres to database root while current user is root?

Your options are:

current user: root; desired user: postgres; desired database: root

in pg_hba.conf:local postgres root md5 and execute: psql -d root -U postgres and login with your password for postgres

current user: postgres; desired user: postgres; desired database: root

in pg_hba.conf: local postgres root peer and execute psql -d root

current user: root; desired user: root; desired database: root

in pg_hba.conf local root root peer and execute psql

Neither to say never to login as root at your database!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.