I have the following scenario:
saji@geeklap:~$ psql -U postgres
psql: FATAL: Ident authentication failed for user "postgres"
saji@geeklap:~$ psql -h localhost -U postgres
Password for user postgres:
psql (8.4.14)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.
postgres=#
I'm trying to log into the postgresql server installed in my system as user postgres. I'm able to login only if I specify -h localhost. Whereas psql documentation says that:
If you omit the host name, psql will connect via a Unix-domain socket to a server on the local host, or via TCP/IP to localhost on machines that don't have Unix-domain sockets.
Ref: http://www.postgresql.org/docs/current/static/app-psql.html#R2-APP-PSQL-CON
Why am I unable to login without specifying the host, is there some configuration file that needs any change for things to occur as told in the psql documentation?
.psqlrcthat specifies the defaults - or just editpg_hba.confto usemd5authentication forlocal(unix socket) connections. See the documentation forpg_hba.confandpsql. – Craig Ringer Nov 15 '12 at 22:44