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

数据库 – 用户“postgres”的密码验证失败

发布时间:2020-12-12 16:31:40 所属栏目:MsSql教程 来源:网络整理
导读:参见英文答案 Postgresql: password authentication failed for user “postgres”9个 我已经在我的CentOS服务器上成功安装PostgreSQL服务器8.4. 之后,我使用’postgres’用户登录到CentOS服务器,但我无法运行任何命令,发生错误: password authentication fa
参见英文答案 > Postgresql: password authentication failed for user “postgres”9个
我已经在我的CentOS服务器上成功安装PostgreSQL服务器8.4.
之后,我使用’postgres’用户登录到CentOS服务器,但我无法运行任何命令,发生错误:

password authentication failed for user “postgres”

这是pg_hba.conf和postgresql.conf中的一些配置:

--------------------configuration in postgresql.conf-----------
listen_addresses = '*'

--------------------configuration in pg_hba.conf---------------
local   all         all                               md5  
local   all         postgres                          md5 
host    all         all         127.0.0.1/32          md5  
host    all         all         ::1/128               md5

解决方法

我倾向于在pg_hba.conf中使用以下内容:
# Database administrative login by UNIX sockets
local   all         postgres                          ident

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   all         all                               md5
host    all         all         127.0.0.1/32          md5
host    all         all         ::1/128               md5

这意味着,一旦你是“postgres”,你不需要密码,但是你需要sudo权限才能成为postgres,所以这很安全.任何其他用户都可以使用简单的md5身份验证登录,这意味着您不必在任何地方都可以使用.这对我来说很好.

(编辑:李大同)

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

    推荐文章
      热点阅读