pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Devrim GUNDUZ <devrim@gunduz.org>
To: Hemapriya <priyam_1121@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Connect to postgres from a script using password
Date: Thu, 8 Jul 2004 19:44:09 +0300 (EEST)
Message-ID: <Pine.LNX.4.44.0407081935480.9193-100000@emo.org.tr> (raw)
In-Reply-To: <20040708160730.73409.qmail@web21326.mail.yahoo.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Thu, 8 Jul 2004, Hemapriya wrote:

> Can anyone tell me how to connect to postgres from a
> shell script using password. If i use psql -UUser db
> -W option it prompts for password everytime.. 
> Is there anyway we can have the password included in
> psql login command.?

Try environmental variables. I use this one:

==========================
export PGPASSWORD=password
export PGUSER=username
psql dbname
==========================

Using ~/.pgpass might be another alternative.

Regards,
- -- 
Devrim GUNDUZ	       
devrim~gunduz.org				devrim.gunduz~linux.org.tr 
			http://www.tdmsoft.com
			http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFA7Xnbtl86P3SPfQ4RAjNZAKDpOVd0wpOu0y3IDYPbq5tG9RFEgACeKDmC
Pgbg6AI0xK3vWh2fW3SCZ8Q=
=1Qfo
-----END PGP SIGNATURE-----




view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0407081935480.9193-100000@emo.org.tr>
Permalink:  ../Pine.LNX.4.44.0407081935480.9193-100000@emo.org.tr/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0407081935480.9193-100000@emo.org.tr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: devrim@gunduz.org, priyam_1121@yahoo.com
  Subject: Re: Connect to postgres from a script using password
  In-Reply-To: <Pine.LNX.4.44.0407081935480.9193-100000@emo.org.tr>
  References: <20040708160730.73409.qmail@web21326.mail.yahoo.com> <Pine.LNX.4.44.0407081935480.9193-100000@emo.org.tr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox