[Devel] Re: PW on posgres script

Klaus Darilion klaus.mailinglists at pernau.at
Fri Dec 16 09:06:37 CET 2005


Bogdan-Andrei Iancu wrote:
> Hi Klaus,
> 
> when I applied Norman's fix regarding the PW env. variable in 
> mysqldb.sh, I wanted to update also the postgres script, but I saw it 
> commented out - any reasons not for providing passwd to postgres? it 
> will be a nice to be able to pass the password via env. without being ask.

Hi Bogdan!


psql works different than mysql. You can not provide the password like 
it is done for mysql. For automatic login with psql you have to use a 
.pgpass file in your home directory.
http://pgsqld.active-venture.com/libpq-files.html

e.g. I have in /home/darilion/.pgpass:
localhost:*:*:openser:openserrw
localhost:*:*:openserro:openserro

file access rights must be 0600:
-rw-------   1 darilion darilion     159 Aug  4 18:07 .pgpass

otherwise psql does not accept the .pgpass file

regards
klaus



More information about the Devel mailing list