加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – psql:FATAL:对用户“dev”的对等身份验证失败

发布时间:2020-12-13 16:54:22 所属栏目:百科 来源:网络整理
导读:当我创建一个新用户,但它不能登录数据库。 我这样做: postgres@Aspire:/home/XXX$ createuser devShall the new role be a superuser? (y/n) nShall the new role be allowed to create databases? (y/n) yShall the new role be allowed to create more n
当我创建一个新用户,但它不能登录数据库。
我这样做:
postgres@Aspire:/home/XXX$ createuser dev
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) y

然后创建一个数据库:

postgres@Aspire:/home/XXX$ createdb -O dev test_development

之后,我尝试用psql -U dev -W test_development登录,但得到错误:

psql: FATAL:  Peer authentication failed for user "dev"

我试图解决问题,但失败。

尝试:
psql user_name  -h 127.0.0.1 -d db_name

哪里

> -h是本地服务器的主机名/ IP,从而避免了Unix域套接字
> -d是要连接到的数据库名称

然后这被评估为一个“网络”连接的Postgresql而不是一个Unix域套接字连接,因此不评价为一个“本地”连接,你可能在pg_hba.conf中看到:

local   all             all                                     peer

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读