Elsasoft Forums
Elsasoft Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SqlSpec
 FAQ
 password for pg_dump.exe?
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Jesse
Forum Admin

732 Posts

Posted - Feb 12 2013 :  6:47:48 PM  Show Profile
I want to get DDL for a postgresql database. pg_dump.exe is not working. I think it's a password issue. How do I specify the password to pg_dump.exe?

From what I understand of pg_dump.exe, you can't pass a password on the cmd line. From the pgsql docs I found this on the pg_dump.exe page:

"If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail."

http://www.postgresql.org/docs/9.1/static/app-pgdump.html

This is likely the case you are dealing with. The workaround appears to be to specify password in the "pgpass" file. So here is the documentation on the pgpass file:

http://www.postgresql.org/docs/9.1/static/libpq-pgpass.html

I think to get this working, you need to add a line to pgpass.conf for the user you are connecting as in your pgsql connection string. Just for reference, here are the contents of my pgpass.conf file on the system I have been using for testing this. I always have been connecting as the user "postgres"

localhost:5432:*:postgres:asdf

On my system, this file is located here: C:\Users\Jesse\AppData\Roaming\postgresql

Note that if you have the PGPASSWORD environment variable set, it may override whatever you have set in the .pgpass file. Use of PGPASSWORD env var is not recommended. More on env vars here: http://www.postgresql.org/docs/9.1/static/libpq-envars.html
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
Elsasoft Forums © Elsasoft LLC Go To Top Of Page
Snitz Forums 2000