Re: How to automate password requests?

From: Tom Hart <tomhart(at)coopfed(dot)org>
To: Marten Lehmann <lehmann(at)cnm(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to automate password requests?
Date: 2007-11-28 18:39:56
Message-ID: 474DB5FC.7050405@coopfed.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marten Lehmann wrote:
> Hello,
>
> I'm trying to automate some postgresql scripts, but I cannot find a
> way to pass a password directly to commands like pg_dump psql and so on.
> Even a
>
> echo "password" | psql
>
> doesn't work, the password prompt of psql is still waiting.
>
> mysql has the -p option. What would be the postgresql equivalent? I
> don't want to enter passwords dozend times.
>
> Regards
> Marten
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
Read about something called the .pgpass file. There's a way to set a
file that contains the password (pgAdmin will create one autmoatically)
that pgsql will look for before it asks for your password. It's stored in ~/

The solution I use is a bat file that redefines an environment variable
(PGPASSFILE) that points to the file, then runs pg_dumpall.

--
Tom Hart
IT Specialist
Cooperative Federal
723 Westcott St.
Syracuse, NY 13210
(315) 471-1116 ext. 202
(315) 476-0567 (fax)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Trevor Talbot 2007-11-28 18:44:07 Re: Linux v.s. Mac OS-X Performance
Previous Message Marten Lehmann 2007-11-28 18:37:18 How to automate password requests?