Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 939
Deepankar Bajpeyi Avatar asked May 28 '13 07:05

Deepankar Bajpeyi


People also ask

How do I access Pgpass conf?

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).

Where is PGPASS?

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.

How do I create a Pgpass file in Windows?

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.


1 Answers

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

pg_dump -U someuser -h localhost somedb > directory/somefile.dump 
like image 190
devnull Avatar answered Sep 22 '22 12:09

devnull