By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

PG_DUMP question

P: n/a
Hi,
is ther a way to pass a password to the pg_dump command to avoid being
prompted for it.
I want to execute the dump from a perl or shell script and dont want to
open accees for the user in the pg_hba.conf

I tried
PGUSER=userid PGPASSWD=passwd pg_dump -Fc -f dump.db mydb;

Thanks
Alex


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Tue, Dec 02, 2003 at 09:31:43AM +0900, Alex wrote:
is ther a way to pass a password to the pg_dump command to avoid being
prompted for it.
I want to execute the dump from a perl or shell script and dont want to
open accees for the user in the pg_hba.conf


Use the ~/.pgpass file. It will work for any libpq program, not just
pg_dump.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"I call it GNU/Linux. Except the GNU/ is silent." (Ben Reiter)

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #2

P: n/a
Thanks,
but I am looking for a way to pass the password to the command rather
than using another config or password file.
I store my config infos in an xml file.
I thought I could set the environment var as suggested on some sites but
it does not seem to be working.
Alex

Alvaro Herrera wrote:
On Tue, Dec 02, 2003 at 09:31:43AM +0900, Alex wrote:
is ther a way to pass a password to the pg_dump command to avoid being
prompted for it.
I want to execute the dump from a perl or shell script and dont want to
open accees for the user in the pg_hba.conf


Use the ~/.pgpass file. It will work for any libpq program, not just
pg_dump.


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #3

P: n/a
On Tue, Dec 02, 2003 at 05:31:45PM +0900, Alex wrote:
but I am looking for a way to pass the password to the command rather
than using another config or password file.
I store my config infos in an xml file.
I thought I could set the environment var as suggested on some sites but
it does not seem to be working.


It should work. Note though that it is called PGPASSWORD, not PGPASSWD
as your example was showing. Be sure to export it.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Las cosas son buenas o malas segun las hace nuestra opinión" (Lisias)

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.