Re: using PGPASSWORD environment variable

From: Andrew Sullivan <andrew(at)libertyrms(dot)info>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: using PGPASSWORD environment variable
Date: 2003-02-20 22:20:28
Message-ID: 20030220172028.C30080@mail.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 20, 2003 at 02:54:28PM -0600, James Hall wrote:
> I am trying to write a [perl] script to automate database backups. PG
> requests the password every time I connect to a database. It was suggested
> that I "use PGPASSWORD environment variable, just set it before you execute
> pg_dumpall".

If you are using pg 7.3, store the password in the .pgpass file in
the home directory of the user instead. It's safer. Keep in mind
that the environment variable might be exposed to others logged into
the machine. (If no-one else logs into the machine, why not use
trust for local users?)

But if you must use it, you can just set it at the beginning of the
script:

PGPASSWORD=[yourpasswordhere]
/path/to/pg_dumpall

A
--
----
Andrew Sullivan 204-4141 Yonge Street
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M2P 2A8
+1 416 646 3304 x110

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-02-20 22:58:09 Re: Fwd: REWRITE_INVOKE_MAX and "query may contain cycles"
Previous Message Egyud Csaba 2003-02-20 21:39:30 How to get the IP address of the conneced user