如何配置PostgreSQL,以允许默认的postgres用户从本地登录时无需密码?有一些类似的问题,比如这个和这个,但是我尝试修改
pg_hba.conf
的建议都没有奏效。基于对pg_hba.conf
规则的理解,我应该能够通过peer
或trust
选项来实现这一目标。我正在尝试运行以下命令:sudo psql --user=postgres --no-password --command="blah;" -h 127.0.0.1
如果我在我的pg_hba.conf
文件中尝试这条线:
local all postgres trust
我的命令执行失败,并出现以下错误:
psql: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", SSL on
FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", SSL off
如果我尝试这条线:
local all postgres peer
我的命令遇到了同样的错误。
我该如何修复这个问题?