【发布时间】:2015-08-29 15:38:17
【问题描述】:
我正在运行 Ubuntu 14.04 并安装了 PostgreSQL 9.3。 将 /etc/postgresql/9.3/main/pg_hba.conf 编辑为:
# "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
我重新启动了服务器,现在我想以 postgres 身份登录 postgres:
victor@workstation:~$ psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
postgres 不应该提示我输入密码,因为我已将其身份验证方法设置为 MD5 吗?
我知道如果我添加 -h localhost 它将起作用。
不添加此标志会导致 psql 使用对等身份验证吗?
【问题讨论】:
-
你必须在上面有另一个
local ... peer行。 -
完美...你为什么不回答呢?我会给你接受的答案。
标签: postgresql authentication psql