Peer authentication failed for user

FATAL: Peer authentication failed for user 'XXX'sql

  • 操做系統:CentOS 7.5
  • PostgreSQL版本:10.4

\c - XXX 切換user時,提示FATAL: Peer authentication failed for user 'XXX' 緣由是PostgreSQL配置文件/var/lib/pgsql/10/data/pg_hba.conf中,local的METHOD爲peer,dom

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer

而正如提示信息,「Peer authentication failed for user 'XXX'」,因此把peer改爲md5後,重啓服務便可。socket

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5

重啓服務命令:systemctl restart postgresql-10post

相關文章
相關標籤/搜索