This forum is no longer active. Please post your questions to our new community site

Forums WAPPStack

pgpass in WAPP?

Subscribe to pgpass in WAPP? 3 post(s), 2 voice(s)

 
Avatar mpugsley 4 post(s)

With Postgres installed from the Postgres site, a file .pgpass exists in order to control ‘auto’ lookups of passwords. That’s how you can connect without supplying a password.

I’ve noticed that I can login with postgres and not supply a password, but now that I’ve changed my password, the wrong password is being automatically supplied. How do I change this since I do not see a .pgpass file anywhere on my computer?

I can correctly connect if I use the -W paramter with psql. But that forces me to answer a prompt. The only way I know to run a script without answering a prompt is to automatically supply a password. I don’t think Postgres has anything like a -ppassword switch.

Thanks,
Matt Pugsley

 
Avatar carlos Administrator 144 post(s)

Hi mpugsley,

You can provide the password setting the environment variable “PGPASSWORD” before running pgsql

set PGPASSWORD=whatever

I hope it helps

 
Avatar mpugsley 4 post(s)

That worked! Thank you, Carlos!

Although I haven’t tried it yet, I bet that I could also set an environment variable for PGPASSFILE which specifies the location of .pgpass and then create my own .pgpass. I thought about the PGPASSFILE setting earlier, but I kept looking in the postgresql.conf file for it (which I would then alter). But I never saw it there, and I didn’t think to create an environment variable.

And FYI for anyone else who needs this solution, this worked for a WindowsXP box.

Thanks again!

Forums WAPPStack