postgresql:无法通过 pgadmin3(和 phppgadmin)进行本地连接
postgresql: Failing to connect locally via pgadmin3 (and phppgadmin)
我可以通过命令行连接,但在 pgadmin3 中收到常见的错误消息。
Error connecting to the server: FATAL: password authentication failed for user "postgres"
(以及 phppgadmin 中的 login failed
)
我知道有几个关于此的 q/a 但 none 正在解决命令行成功/pgadmin3 失败。
我已经进行了建议的更改,例如:
在postgresql.conf
中添加listen_addresses = '*'
as 还修改 pg_hba.conf
的结尾行如下(从 peer 切换到 md5):
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
# host replication postgres ::1/128 md5
另外,以下方式连接失败:
psql -h localhost -U postgres -d postgres
(密码失败)
但是,这样的连接成功了:
sudo -u postgres psql
Password: ****
事实证明,服务器正在侦听 5433,并且两个 GUI 都在尝试连接到 5432...错误消息
password authentication failed
不过误导性很强....
我可以通过命令行连接,但在 pgadmin3 中收到常见的错误消息。
Error connecting to the server: FATAL: password authentication failed for user "postgres"
(以及 phppgadmin 中的 login failed
)
我知道有几个关于此的 q/a 但 none 正在解决命令行成功/pgadmin3 失败。
我已经进行了建议的更改,例如:
在postgresql.conf
listen_addresses = '*'
as 还修改 pg_hba.conf
的结尾行如下(从 peer 切换到 md5):
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
# host replication postgres ::1/128 md5
另外,以下方式连接失败:
psql -h localhost -U postgres -d postgres
(密码失败)
但是,这样的连接成功了:
sudo -u postgres psql
Password: ****
事实证明,服务器正在侦听 5433,并且两个 GUI 都在尝试连接到 5432...错误消息
password authentication failed
不过误导性很强....