Re: Passing password in psql command

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Technical Doubts <online(dot)technicaldoubts(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Passing password in psql command
Date: 2015-03-02 09:42:58
Message-ID: 20150302094258.GB7715@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Mar 02, 2015 at 02:57:46PM +0530, Technical Doubts wrote:
> Dear Team,
> We are unable to connect to PostgreSQL db using psql by passing password
> parameter. If we don't give password, then on password promt it's accepting
> the password we type. But our scheduler script is having the psql line with
> password parameter. Helps highly appreciated. Thanks in advance.

There is no option to provide password in command line.

You either have to use environment variable, as described here:
http://www.postgresql.org/docs/current/interactive/libpq-envars.html
or pgpass file, as described here:
http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html

Both of these places are listed in docs for psql
(http://www.postgresql.org/docs/current/interactive/app-psql.html) in
part "connecting to a database".

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ruth Melendo 2015-03-02 10:05:09 PostgreSQL with BDR. Problems when adding a sequence in a table column
Previous Message Marco Nietz 2015-03-02 09:33:31 Re: Passing password in psql command