Thread: How to set password in psql -h -d -U command line?
I tried various ways to set password in psql command line, but got no luck.
Can anyone help?
Regards,
David
> I tried various ways to set password in psql command line, but got no luck. Have you tried all the methods that you showed in your mail or did you try others as well ? Best regards, Karsten
Hello,
I usually use this approach:
PGPASSWORD=secret psql -h 127.0.0.1 -p 5432 -U joao mydatabase
it has the down side that the password is shown in the command. need to be careful about that aspect
On Thu, Apr 28, 2022 at 10:33 AM Shaozhong SHI <shishaozhong@gmail.com> wrote:
I tried various ways to set password in psql command line, but got no luck.Can anyone help?Regards,David
Either set the PGPASSWORD environment variable or set up a .pgpass file
Josha
On Thu, 28 Apr 2022 at 19:33, Shaozhong SHI <shishaozhong@gmail.com> wrote:
I tried various ways to set password in psql command line, but got no luck.Can anyone help?Regards,David
Kind Regards
Josha Inglis
On Thu, Apr 28, 2022 at 3:13 PM Josha Inglis <joshainglis@gmail.com> wrote:
Either set the PGPASSWORD environment variable or set up a .pgpass file--JoshaOn Thu, 28 Apr 2022 at 19:33, Shaozhong SHI <shishaozhong@gmail.com> wrote:I tried various ways to set password in psql command line, but got no luck.Can anyone help?Regards,DavidKind RegardsJosha Inglis