# TYPE DATABASE USER CIDR-ADDRESS METHOD # "local" is for Unix domain socket connections only local all all ident # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident
我想启用md5登录,以便名为’foo’的Postgresql用户可以访问名为’foo’的数据库.但是,当我添加此行并重新启动postgres时:
local foo foo md5
使用我的常规用户帐户运行psql -U’foo’仍然会产生以下消息:
psql: FATAL: Ident authentication Failed for user "foo"
在我通过md5登录到’foo’之前,我必须删除第一个本地行(有ident).
如何在保持身份验证的同时为’foo’启用md5身份验证?
Since the pg_hba.conf records are
examined sequentially for each
connection attempt,the order of the
records is significant. Typically,
earlier records will have tight
connection match parameters and weaker
authentication methods,while later
records will have looser match
parameters and stronger authentication
methods. For example,one might wish
to use trust authentication for local
TCP/IP connections but require a
password for remote TCP/IP
connections. In this case a record
specifying trust authentication for
connections from 127.0.0.1 would
appear before a record specifying
password authentication for a wider
range of allowed client IP addresses.
(因此请尝试撤消订单 – 将您添加的行放在顶部)