pg_hba.conf - psql本地无密码登录

vrm*_*rms 4 postgresql user-management

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
Run Code Online (Sandbox Code Playgroud)

我应该local all postgres trust允许我在本地登录,而psql 无需以 UNIX 用户身份查询密码postgres

然而:

postgres@my-vm:/opt/db/postgres/bin> psql
Password for user postgres:
Run Code Online (Sandbox Code Playgroud)

postgres该用户还没有现有的 psql 密码

小智 7

local  all  all       md5  
local  all  postgres  trust   # ident  
Run Code Online (Sandbox Code Playgroud)

请记住,pg_hba 中的条目是按照它们给出的顺序进行处理的。

“本地所有 postgres 信任”...应该允许我登录...而无需...密码

如果它出现在强制每个本地连接使用md5身份验证的行之前,它就会出现