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:
Show quoted text
I tried various ways to set password in psql command line, but got no luck.
Can anyone help?
Regards,
David
https://www.postgresql.org/docs/current/libpq-envars.html
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
Don't Do This - PostgreSQL wiki
<https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_psql_-W_or_--password>
On Thu, Apr 28, 2022 at 3:13 PM Josha Inglis <joshainglis@gmail.com> wrote:
Show quoted text
https://www.postgresql.org/docs/current/libpq-envars.html
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 RegardsJosha Inglis