Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

bash - postgresql: .pgpass not working

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 ?

question from:https://stackoverflow.com/questions/16786011/postgresql-pgpass-not-working

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...