当前位置:首页 > 云计算 > 正文内容

postgresql怎么登录上

2022-05-04 03:14:29云计算5

postgresql登录失败的解决方法:

1.确认phpPgAdmin是否可以链接到postgresql数据库,方法:查看data/pg_log下的log有没有phpPgAdmin的访问记录,有则说明可以链接。

以下为出错信息:

LOG:providedusername(postgres)andauthenticatedusername(apache)don'tmatch
FATAL:Identauthenticationfailedforuser"postgres"

2.查看postgresql的认证方法:pg_hba.conf

#"local"isforUnixdomainsocketconnectionsonly
localallallident
#IPv4localconnections:
hostallall127.0.0.1/32md5
#IPv6localconnections:
hostallall::1/128md5

看着好像跟ident认证方式有点关系,最后在官方文档找到一句话:

WhenusinganexternalauthenticationsystemlikeIdentorGSSAPI,thenameoftheoperatingsystem
userthat
initiatedtheconnectionmightnotbethesameasthedatabaseuserheneedstoconnectas.

明白了,原来上面的[local all all ident]搞的鬼,如果是ident的话需要配置 pg_ident.conf文件,所以果断换成除以上两种加密方式外的方法

重启postgresql:#service postgresql restart.

再访问一次,成功。

本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.

本文链接:https://www.xibujisuan.cn/10201.html

标签: Python