设为首页收藏本站

SAP Best Business Solution

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 926|回复: 0

psql: FATAL: Ident authentication failed for user "username" Error

[复制链接]

24

主题

24

帖子

197

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
197
发表于 2017-7-24 09:09:55 | 显示全部楼层 |阅读模式
psql: FATAL: Ident authentication failed for user "username" Error and Solution
I’ve installed Postgresql under Red Hat Enterprise Linux 5.x server. I’ve created username / password and database. But when I try to connect it via PHP or psql using following syntax:
sql -d myDb -U username -W
It gives me an error that read as follows:
psql: FATAL: Ident authentication failed for user “username”
How do I fix this error?

A. To fix this error open PostgreSQL client authentication configuration file /var/lib/pgsql/data/pg_hba.conf :
# vi /var/lib/pgsql/data/pg_hba.conf
This file controls:
  • Which hosts are allowed to connect
  • How clients are authenticated
  • Which PostgreSQL user names they can use
  • Which databases they can access
By default Postgresql uses IDENT-based authentication. All you have to do is allow username and password based authentication for your network or webserver. IDENT will never allow you to login via -U and -W options. Append following to allow login via localhost only:

local        all        all        trust
host        all        127.0.0.1/32        trust

Save and close the file. Restart Postgresql server:

# service postgresql restart

Now, you should able to login using following command:
$ psql -d myDb -U username -W
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



QQ|Archiver|手机版|小黑屋|www.sapbbs.com    

GMT+8, 2018-10-22 23:26 , Processed in 0.416050 second(s), 30 queries .

声明:本站严禁任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论!

本站内容由网友原创或转载,如果侵犯了您的合法权益,请及时联系处理!© admin@sapbbs.com

快速回复 返回顶部 返回列表