由于“主机没有pg_hba.conf条目”,因此无法远程连接到Postgres

编辑:最初的问题是关于连接的。

感谢您的评论,我被告知我必须添加防火墙规则。我做到了:

sudo ufw allow 5432/tcp

现在我得到了另一个错误FATAL: no pg_hba.conf entry for host "[my_ip]"

现在确定为什么要允许该文件中的所有文件吗?


原始:

我在运行ubuntu 18的数字海洋小滴上建立了一个PostgreSQL数据库。

我想在PGAdmin 4中连接到它。

我已经编辑过postgressql.conf

listen_addresses = '*'

我已经编辑了pg_hba.conf

host all all ::/0 md5

然后我跑了sudo service postgresql restart

在PGAdmin内部,仍然出现此错误:

Unable to connect to server:

could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "[redacted]" ([redacted]) and accepting
TCP/IP connections on port 5432?

conf文件说它是5432

jiao860809 回答:由于“主机没有pg_hba.conf条目”,因此无法远程连接到Postgres

我将此附加内容替换为pg_hca.conf文件:

host all all ::/0 md5

使用

host all all 0.0.0.0/0 md5

我无法连接PGAdmin 4

本文链接:https://www.f2er.com/3137011.html

大家都在问