Thread: scripts and ~/.psqlrc

scripts and ~/.psqlrc

From
teknet@poczta.onet.pl
Date:
Hello

I want to write some scripts which could connect to databse and work in background. I want to avoid situation in which
ihave to manually/interactively give appriopriate password everytime i query database. 

How can i do it in most easily way ?

I found that there is ~/.psqlrc file which could be used as configuration file for user. Can i put there databsename,
hostname,username and most important: password ?, so i could connect to my database only by typing: 
#psql

Thanx
Michal

Re: scripts and ~/.psqlrc

From
Peter Eisentraut
Date:
teknet@poczta.onet.pl wrote:
> I found that there is ~/.psqlrc file which could be used as
> configuration file for user. Can i put there databsename, hostname,
> username and most important: password ?, so i could connect to my
> database only by typing: #psql

The file you are looking for is ".pgpass".

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: scripts and ~/.psqlrc

From
"Tomeh, Husam"
Date:
" PGPASSWORD sets the password used if the server demands password
authentication. Use of this environment variable is not recommended for
security reasons (some operating systems allow non-root users to see
process environment variables via ps); instead consider using the
~/.pgpass file  "


--
 Husam


-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of
teknet@poczta.onet.pl
Sent: Saturday, October 15, 2005 9:08 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] scripts and ~/.psqlrc

Hello

I want to write some scripts which could connect to databse and work in
background. I want to avoid situation in which i have to
manually/interactively give appriopriate password everytime i query
database.

How can i do it in most easily way ?

I found that there is ~/.psqlrc file which could be used as
configuration file for user. Can i put there databsename, hostname,
username and most important: password ?, so i could connect to my
database only by typing:
#psql

Thanx
Michal

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@postgresql.org so that your
       message can get through to the mailing list cleanly

**********************************************************************
This message contains confidential information intended only for the
use of the addressee(s) named above and may contain information that
is legally privileged.  If you are not the addressee, or the person
responsible for delivering it to the addressee, you are hereby
notified that reading, disseminating, distributing or copying this
message is strictly prohibited.  If you have received this message by
mistake, please immediately notify us by replying to the message and
delete the original message immediately thereafter.

Thank you.                                       FADLD Tag
**********************************************************************