Postgres psql: FATAL: Peer authentication failed for user "xxx"

前端之家收集整理的这篇文章主要介绍了Postgres psql: FATAL: Peer authentication failed for user "xxx"前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

In pg_hba.conf,thefirst matchcounts.Per documentation:

The first record with a matching connection type,client address,requested database,and user name is used to perform authentication. There is no "fall-through" or "backup": if one record is chosen and the authentication fails,subsequent records are not considered. If no record matches,access is denied.


编辑pg_hba.conf

# vim /var/lib/pgsql/9.6/data/pg_hba.conf


# Postgresql Client Authentication Configuration File

# ===================================================

#

# Refer to the "Client Authentication" section in the Postgresql

# documentation for a complete description of this file. A short

# synopsis follows.

# 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. Records take one of these forms:

# local DATABASE USER METHOD [OPTIONS]

# host DATABASE USER ADDRESS METHOD [OPTIONS]

# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]

# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]

local all xxx trust


保存后reload配置文件

# /etc/init.d/postgresql-9.6 reload


重新登录

# psql -U xxx -d msolution.cn_development

psql (9.6.1)

Type "help" for help.


xxx=>

原文链接:https://www.f2er.com/postgresql/193951.html

猜你在找的Postgre SQL相关文章