postgresql: .pgpass not working

Deepankar Bajpeyi picture Deepankar Bajpeyi · May 28, 2013 · Viewed 36.2k times · Source

I have created a .pgpass file in my home directory which looks like this

localhost:5432:somedb:someuser:somepass

I am using a shell script which creates a directory and puts a pg_dump of somedb there :

mkdir directory
pg_dump somedb > directory/somefile.dump

It still prompts for the password.

Where is the mistake here ?

Answer

devnull picture devnull · May 28, 2013

Did you try specifying the host, user, & db?

pg_dump -U someuser -h localhost somedb > directory/somefile.dump