Dev*_*she 2 postgresql pg-hba.conf
现在我的 Postgres 的 pg_hba.conf 文件有以下几行:
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
#Should allow connection without password
host all all 0.0.0.0/0 trust
host all all ::0/0 trust
Run Code Online (Sandbox Code Playgroud)
(我知道这是不安全的。我只是在测试,一旦成功,我将只保留特定用户和数据库)
我的理解是trust应该允许用户在没有密码的情况下进行连接。
但是当我这样做时psql -U postgres -d postgres -h 127.0.0.1 -w,我收到错误消息:psql: fe_sendauth: no password supplied
我需要做什么才能允许用户在没有密码的情况下进行连接?
当pg_hba.conf被检查的认证请求,所述第一匹配确定规则。
具有匹配连接类型、客户端地址、请求的数据库和用户名的第一条记录用于执行身份验证。没有“fall-through”或“backup”:如果选择了一条记录并且认证失败,则不考虑后续记录
(强调我的)
在你的情况下,线路:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
Run Code Online (Sandbox Code Playgroud)
在trust您添加的行之前匹配,因此 Postgres 需要密码。如果您想完全禁用密码验证,您必须禁用md5验证,例如通过注释这些行。
| 归档时间: |
|
| 查看次数: |
12185 次 |
| 最近记录: |