Re: hardcode password in connect string - Mailing list pgsql-general

From Martín Marqués
Subject Re: hardcode password in connect string
Date
Msg-id 4ee7b3cf-bb0d-2131-d37e-ec8f547d0234@2ndquadrant.com
Whole thread Raw
In response to Re: hardcode password in connect string  (Raymond O'Donnell <rod@iol.ie>)
List pgsql-general
El 15/04/18 a las 12:16, Raymond O'Donnell escribió:
> On 15/04/18 12:35, Ricardo Martin Gomez wrote:
>> Hello David,
>> I think so, the parameter you need in psql command is -w mipassword.
> 
> Sorry, this is not correct. -w causes psql *never* to prompt for a
> password, and -W forces a password prompt. Neither allows the password
> to be passed as an argument - I don't think that this is possible with
> psql.

It is possible, you just have to construct the whole string:

psql "host=thehost dbname=mydatabase user=memyselfi password=mypassword"

Still, the best option, and the most secure, is to use a .pgpass file.
The psql invocation with it's password will very likely end in
.bash_history and alike.

Regards,

-- 
Martín Marqués                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


pgsql-general by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: hardcode password in connect string
Next
From: armand pirvu
Date:
Subject: Re: authentication failure