Centos – PostgreSQL can’t authenticate from localhost, but only from remote

centospostgresql

I have a server with postgreSQL running. A few days ago I set it up so that I can access the database remotely from my home PC and that worked (based on this guide: http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html). Now I noticed that for whatever reason, I can not access the database via localhost or 127.0.0.1.

psql mydatabase works without any problem. psql -h myDomain.net mydatabase also works. psql -h localhost mydatabase tells me

psql: FATAL: Ident authentication failed for user "smaug"

I tried reverting the changes that I made earlier to get remote access to the DB to no avail.

What could be the cause of this problem?

Best Answer

ok I found out the problem. Going to the file /var/lib/pgsql/data/pg_hba.conf, looking for the line

host all all 127.0.0.1/32 ident

and replacing ident with trust apparently fixed the issue.