Re: scripts and ~/.psqlrc

Lists: pgsql-admin
From: teknet(at)poczta(dot)onet(dot)pl
To: pgsql-admin(at)postgresql(dot)org
Subject: scripts and ~/.psqlrc
Date: 2005-10-15 16:08:12
Message-ID: 20051015160813Z1262521-16585+5@kps6.test.onet.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

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


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Cc: teknet(at)poczta(dot)onet(dot)pl
Subject: Re: scripts and ~/.psqlrc
Date: 2005-10-15 21:03:50
Message-ID: 200510152303.50846.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

teknet(at)poczta(dot)onet(dot)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/