pdAdmin4无法连接到PostgreSQL

pdAdmin4无法连接到PostgreSQL,postgresql,ubuntu,pgadmin-4,Postgresql,Ubuntu,Pgadmin 4,我已经成功地在ubuntu18.04上安装了PostgreSQL和pdAdmin4,但是在将pdAdmin4连接到PostgreSQL时遇到了问题。当我在pdAdmin4中输入以下配置并单击保存时,我会收到此错误消息 我已经检查过了,PostgreSQL正在端口5432上运行 $ sudo netstat -plunt |grep postgres tcp 0 0 127.0.0.1:5432 0.0.0.0:* LIST

我已经成功地在
ubuntu18.04
上安装了
PostgreSQL
pdAdmin4
,但是在将pdAdmin4连接到PostgreSQL时遇到了问题。当我在pdAdmin4中输入以下配置并单击保存时,我会收到此错误消息

我已经检查过了,PostgreSQL正在端口
5432上运行

$ sudo netstat -plunt |grep postgres
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      1283/postgres
----更新---

更新了文件
postgresql.conf
,下面有一行

listen_addresses = '*'
使用以下行更新文件
pg_hba.conf

# IPv4 local connections:
host    all             all             0.0.0.0/0               md5
host    all             all             127.0.0.1/32            md5
检查PostgreSQL端口

$ sudo netstat -plunt |grep postgres
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      4515/postgres       
tcp6       0      0 :::5432                 :::*                    LISTEN      4515/postgres

您的pgAdmin和postgres是否在同一台机器上运行?我想您可能需要用运行postgres的机器的实际IP地址替换
localhost
。您可以检查
iptables
是否允许使用localhost吗?还有,我忘了,但是pgsql有一个conf文件,上面写着哪个ip可以连接到它。@richyn是的,两个都在同一个服务器上machine@BagusTesa我已经更新了问题,你能看看你能用psql连接吗?