Is there a psql client config file analogous to $HOME/my.cnf for mysql ?

Jerry picture Jerry · May 7, 2013 · Viewed 7.9k times · Source

That is, a local file on the client machine with default "host", "port", "user" values, etc., so that I don't have to enter them on the command line each time?

Answer

Clodoaldo Neto picture Clodoaldo Neto · May 7, 2013

Use the password file with lines like:

hostname:port:database:username:password

If you always log into the same host:db:port:user then this will make it:

*:*:*:*:mypassword