首页 文章

PostgreSQL:pg_hba.conf中的MD5身份验证给了我致命:用户“postgres”的对等身份验证失败

提问于
浏览
0

我正在运行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"

是不是't postgres prompt for my password, as I'已将其身份验证方法设置为 MD5

我明白如果我添加 -h localhost 它会起作用 .

不添加此标志会导致psql使用对等身份验证吗?

1 回答

  • 1

    你必须有另一条 local ... peer 线 . 错误 Peer authentication failed 来自服务器,它是选择auth方法的服务器 .

    其他可能性是:

    • 实际上没有重启服务器

    • 如果系统上有多个PostgreSQL实例,则编辑错误的 pg_hba.conf 文件 .

相关问题