如何使用 .pgpass 文件中给出的密码连接到 postgres?
How to connect to postgres with password given in .pgpass file?
我的 .pgpass 文件在 home/centos 目录中,具有 0600 权限。
10.43.11.123:5432:mydb:postgres:abcd@1234
(真实密码包含反斜杠字符。)
这篇link
中给出的所有方法我都试过了
没有任何效果。
我尝试了 python can not use .pgpass while connecting to PostgreSQL 中提供的解决方案,但这也无济于事
每次报错:
psql: fe_sendauth: no password supplied
我也试过:
psql -h 10.43.11.123 -d mydb -U postgres
提示:
psql: FATAL: password authentication failed for user "postgres"
password retrieved from file "/home/centos/.pgpass"
有人能帮忙吗?
If an entry needs to contain :
or \
, escape this character with \
.
既然你说密码包含一个反斜杠字符,那么解决方案就是加倍那个反斜杠。
我的 .pgpass 文件在 home/centos 目录中,具有 0600 权限。
10.43.11.123:5432:mydb:postgres:abcd@1234
(真实密码包含反斜杠字符。)
这篇link
中给出的所有方法我都试过了没有任何效果。
我尝试了 python can not use .pgpass while connecting to PostgreSQL 中提供的解决方案,但这也无济于事
每次报错:
psql: fe_sendauth: no password supplied
我也试过:
psql -h 10.43.11.123 -d mydb -U postgres
提示:
psql: FATAL: password authentication failed for user "postgres" password retrieved from file "/home/centos/.pgpass"
有人能帮忙吗?
If an entry needs to contain
:
or\
, escape this character with\
.
既然你说密码包含一个反斜杠字符,那么解决方案就是加倍那个反斜杠。