pgadmin / postgresql - 没有主机的 pg_hba.conf 条目

Kev*_*vin 6 postgresql

我正在尝试使用 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错误消息。

有谁知道我可能做错了什么?

预先感谢!

Eva*_*oll 6

你编辑错了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.confSERVER上编辑,而不是CLIENT。(每@joanolo)

  • 为了完整起见:应该指出“hba_file”位于*服务器*[可能是虚拟]机器上,而不是*客户端*上。 (2认同)