PG::ConnectionBad (FATAL: Peer authentication failed)和pq: Ident authentication failed for user "xxx“

 find / -name 'pg_hba.conf'
/var/lib/pgsql/data/pg_hba.conf

修改文件:

# "local" is for Unix domain socket connections only
local   all             all                                     Peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            Ident
# IPv6 local connections:
host    all             all             ::1/128                 Ident

新文件为:

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

 

你可能感兴趣的:(数据库)