Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Pass password in scripts?



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(at)jammconsulting(dot)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




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group