关于链接PostgreSQL时提示 FATAL: password authentication failed for user "链接用户名" 的解决办法【本身试验经过】

借鉴sql

http://www.javashuo.com/article/p-zhwuxoug-da.htmlpost

一直觉得是密码设错了,其它应该是权限问题【我的理解】.net

alter role postgres with password '123';rest

 

解决方法
一、编辑pg_hba.conf,将md5认证修改为trust认证,编辑后退出保存postgresql

三、psql链接,用alter role修改密码
[postgres @ pgsqldb-master bin]$ psql
psql (9.2.3)
Type "help" for help.

postgres=# alter role postgres with password '123';
ALTER ROLE
postgres=#blog

四、退出psql
五、编辑pg_hba.conf,将turst认证修改为md5认证,编辑后退出保存md5

重启get

systemctl restart postgresql-9.6it

在postgres用户下执行下面,输入密码能够进去,就说明密码设置成功了。ast

root下面也能够直接输入下面句子

psql -h 127.0.0.1 -U postgres

 

这时若是pg_hba.conf若是有远程配置

host    all             all             0.0.0.0/0            md5

postgres.conf中

listen_addresses = '*'

远程则也能够了

相关文章
相关标签/搜索