Re: Passing password in psql command

Поиск
Список
Период
Сортировка
От Oleksandr Kylymnychenko
Тема Re: Passing password in psql command
Дата
Msg-id CAORx2OsxZFQojdMZk7TyBG267zt2NLdE7npJ5uLgSBrUHbOd8A@mail.gmail.com
обсуждение исходный текст
Ответ на Passing password in psql command  (Technical Doubts <online.technicaldoubts@gmail.com>)
Список pgsql-admin
Hi,

for a scripting solution if you don't want to use any possibilities mentioned before, you might want to have a look at *expect* then to catch the prompt and send your password. 

Alex.

hubert depesz lubaczewski <depesz@depesz.com> schrieb am Mo., 2. März 2015 um 10:44 Uhr:
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/


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

В списке pgsql-admin по дате отправления:

Предыдущее
От: Harshad Adalkonda
Дата:
Сообщение: Re: Installing PostgreSQL fails
Следующее
От: Greg Spiegelberg
Дата:
Сообщение: Re: PostgreSQL with BDR. Problems when adding a sequence in a table column