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 ?
On Microsoft Windows, the pgpass file is located as followed: On Microsoft Windows the file is named %APPDATA%\postgresql\pgpass. conf (where %APPDATA% refers to the Application Data subdirectory in the user's profile).
The file . pgpass in a user's home directory can contain passwords to be used if the connection requires a password (and no password has been specified otherwise). On Microsoft Windows the file is named %APPDATA%\postgresql\pgpass.
It can also be set from command prompt opened as administrator. Right-click on "Command Prompt" option and choose "Runas Administrator". Command to set pasword: "net user user_name new_password". Now connection will be via pgpass.
Did you try specifying the host, user, & db?
pg_dump -U someuser -h localhost somedb > directory/somefile.dump
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With