3

I have been using postgreSQL, trying to dump plain backup file using command:

psql -U postgres DATABASE < path to file.backup

But getting peer authentication failure. Even tried changing pg_hba.conf from peer to md5, but didn't work.

3
  • 4
    peer means you are not OS user postgres, while trying to connect as one, sudo su - postgres and then psql DBNAME >file.sql Commented Jun 20, 2017 at 10:43
  • Thanks a lot, it worked for me. Commented Jun 20, 2017 at 10:46
  • sudo su - postgres Commented Jun 20, 2017 at 10:47

1 Answer 1

5

peer means you are not OS user postgres, while trying to connect as one,

  1. sudo su - postgres
  2. and then psql DBNAME >file.sql

https://www.postgresql.org/docs/current/static/auth-methods.html#AUTH-PEER

The peer authentication method works by obtaining the client's operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.