Getting error: Peer authentication failed for user “postgres”

CategoriesRuby on Rails, Software Development

The problem is still your pg_hba.conf file*.

This line:

local   all             postgres                                peer

Should be:

local   all             postgres                                md5

* The location of this file isn’t very consistent. The command locate pg_hba.conf should help; here’s some examples: /etc/postgresql/*/main/pg_hba.conf and /var/lib/pgsql/data/pg_hba.conf.

After altering this file, don’t forget to restart your PostgreSQL server. If you’re on Linux, that would be sudo service postgresql restart.

Leave a Reply