FATAL: Peer authentication failed for user 'XXX'sql
\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