【发布时间】:2019-11-08 15:02:00
【问题描述】:
编辑:最初的问题是关于连接的。
感谢 cmets,通知我必须添加防火墙规则。我做到了:
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
【问题讨论】:
-
数据库主机上是否有激活的防火墙?
-
我不确定。我会努力解决的
-
@a_horse_with_no_name 当我执行
sudo ufw status verbose时,它显示 22/tcp 和 80/tcp(以及 v6 部分),动作为ALLOW IN。 5432应该在里面吗? -
你必须在你的ufw中打开5432。
-
这不是编程问题。您可以在dba.stackexchange.com 询问并在那里解决。