If you’re new to work with PostgreSQL, surely you will come across this issue while logging into postgres via psql command.
# psql -U postgres postgres
psql: FATAL: Ident authentication failed for user “postgres”
You might have installed PostgreSQL freshly. Reading through its configuration documentation might through some light on resolving this issue. First check and confirm that PostgreSQL is up and running through startup scripts found in /etc/init.d. Once this is done, you will be able to find the configuration files of PostgreSQL in place. You might want to make some changes to postgresql.conf file to customize the configuration.
Now its time to ensure that users can access the database via TCP/IP on any given machine. The pg_hba.conf file controls this activity. I wanted to allow connection from local system to my PostgreSQL, hence my pg_hba.conf file configuration looks as follows. (do not add the last line if your system does not support IPv6):
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust
Make sure that no other lines are uncommented in this file.
Stop and restart PostgreSQL after making these changes and then try connecting with success.



