Thursday, January 17, 2013

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

$ psql -d database -U username -W
psql: FATAL: Ident authentication failed for user "username"

fix
 # vi /var/lib/pgsql/data/pg_hba.conf
This file contains the hosts allowed to connect, clients  authenticatation, database users to use, which databases can be accessed

By default postgresql uses IDENT-based authentication. IDENT will never allow you to login via -U and -W options.
So append following lines to allow login from localhost :
 
local all all trust
host all 127.0.0.1/32 trust

esc -> wq -> enter

# service postgresql restart

$ psql -d database -U username -W
 now you can able to connect

No comments:

Post a Comment