pg_hba.conf
我在PostgreSQL-12.6 安装中有这些设置
# "local" is for Unix domain socket connections only
local all all md5
local all postgres trust # ident
# IPv4 local connections:
host all all 127.0.0.1/32 trust # md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
我local all postgres trust
希望允许我本地登录psql
没有以 unix 用户身份查询密码postgres
。
然而:
postgres@my-vm:/opt/db/postgres/bin> psql
Password for user postgres:
postgres
当前用户还没有 psql 密码
答案1
local all all md5
local all postgres trust # ident
请记住,pg_hba 中的条目会被处理按照他们给出的顺序。
“本地所有 postgres 信任”...应该允许我登录...无需...密码
而且它会,如果出现前迫使每一个要使用的本地连接md5验证!