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.

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132
Yogesh Singh
  • 35
  • 1
  • 6

1 Answers1

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.

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132