Re: Pass password in scripts? - Mailing list pgsql-novice

From Burak Seydioglu
Subject Re: Pass password in scripts?
Date
Msg-id 1b8a973c0702141728x6d398f58td34249d4254a8867@mail.gmail.com
Whole thread Raw
In response to Pass password in scripts?  ("Neil Aggarwal" <neil@JAMMConsulting.com>)
List pgsql-novice
I have two solutions that might help.

PHP:

system("echo -n -e \"".$password."\n\" | pg_dump -W --host=".$host."
-U ".$user." ".$database." > ".$backup_file,$output);

Try replacing pg_dump command with "psql -d database -U user"

BASH:

PGDATABASE=database
PGUSER=user
PGPASSWORD=password

export PGUSER PGPASSWORD

HTH,

Burak

On 2/14/07, Neil Aggarwal <neil@jammconsulting.com> wrote:
> Hello:
>
> I have several scripts I would like to run against a database.
>
> With mysql, I can pass the password to the database in
> the command line call to the terminal client.
>
> Is there a way to do that with psql?
>
> There is no corresponding user account for
> the database user account.
>
> Thanks,
>         Neil
>
>
> --
> Neil Aggarwal, (214)986-3533, www.JAMMConsulting.com
> FREE! Eliminate junk email and reclaim your inbox.
> Visit http://www.spammilter.com for details.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>

pgsql-novice by date:

Previous
From: "Neil Aggarwal"
Date:
Subject: Pass password in scripts?
Next
From: Jan Danielsson
Date:
Subject: Re: Pass password in scripts?