小编Jon*_*han的帖子

Postgresql 连接被拒绝

我正在尝试远程连接到我的 postgresql 数据库。我设置了两个运行 ubuntu 14.04 的虚拟机。我正在尝试使用第一个虚拟机连接到第二个虚拟机

psql -h 10.0.1.23 -U postgres -d postgres
Run Code Online (Sandbox Code Playgroud)

但我收到错误:

Could not connect to server: Connection refused
    Is the server running on host "10.0.1.23" and accepting
    TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

我已经更改了 pg_hba.conf 并添加了

host all all 10.0.1.64/24 md5
host all all * md5
host all all 0.0.0.0/0 md5
Run Code Online (Sandbox Code Playgroud)

并更改了 postgresql.conf listen_address=" * "

试图允许所有传入连接。我还尝试更改防火墙设置,但我不确定端口是否正确侦听连接。

编辑:输出

netstat -an | grep -E '^tcp[^6].*LISTEN'
tcp   0   0 127.0.1.1:53   0.0.0.0:*    LISTEN
tcp   0   0 0.0.0.0:22     0.0.0.0:*    LISTEN
tcp   0 …
Run Code Online (Sandbox Code Playgroud)

postgresql

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

postgresql ×1