Thread: PG_DUMP question
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
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)
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. > > >
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)