我正在尝试使用 pgAdmin 连接到由 Elephantsql 托管的 Postgresql 服务器。但是,我不断收到错误消息no pg_hba.conf entry for host
:
no pg_hba.conf entry for host "173.18.54.553", user "db_user", database "db_name", SSL on FATAL: no pg_hba.conf entry for host "xxx.xx.xxx.xxx", user "hcexhbhx", database "postgres", SSL off
在做了一些研究之后,我编辑了我的pg_hba.conf
文件:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 173.66.143.244/24 md5 (new entry)
host all all 0.0.0.0/0 md5 (new entry)
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication uzrrrrd trust
#host replication uzrrrrd 127.0.0.1/32 trust
#host replication uzrrrrd ::1/128 trust
Run Code Online (Sandbox Code Playgroud)
我在我的postgres.conf
文件中添加了一行:
listen_addresses='*'
在尝试再次连接之前,我重新启动了 postgresql。但是,我仍然收到no pg_hba.conf entry for host
错误消息。
有谁知道我可能做错了什么?
预先感谢!
你编辑错了pg_hba.conf
,在本地连接psql
并运行这个
SHOW hba_file;
Run Code Online (Sandbox Code Playgroud)
然后从外部编辑该文件。也许你有两个版本的 PostgreSQL 或者你自己构建的。或者,您重新启动了错误的 PostgreSQL。也许确保您通过连接重新启动正确的,再次通过 psql 本地连接,然后运行
SELECT pg_reload_conf();
Run Code Online (Sandbox Code Playgroud)
确保您正在尝试连接pg_hba.conf
的SERVER上编辑,而不是CLIENT。(每@joanolo)
归档时间: |
|
查看次数: |
24479 次 |
最近记录: |