I'm getting the error:
FATAL: Peer authentication failed for user "postgres"
when I try to make postgres work with Rails.
Here's my pg_hba.conf
, my database.yml
, and a dump of the full trace.
I changed authentication to md5 in pg_hba and tried different things, but none seem to work.
I also tried creating a new user and database as per Rails 3.2, FATAL: Peer authentication failed for user (PG::Error)
But they don't show up on pgadmin or even when I run sudo -u postgres psql -l
.
Any idea where I'm going wrong?
Best Answer
The problem is still your
pg_hba.conf
file*.This line:
Should be:
After altering this file, don't forget to restart your PostgreSQL server. If you're on Linux, that would be
sudo service postgresql restart
.These are brief descriptions of both options according to the official PostgreSQL docs on authentication methods.
Peer authentication
Password authentication
Sample location for
pg_hba.conf
:/etc/postgresql/9.1/main/pg_hba.conf