擅长:python、mysql、java
<p>我觉得问题是TCP连接没有启用,必须修改你的pg_hba.conf文件以允许连接。在配置文件中添加行以允许连接</p>
<pre><code>host all all 0.0.0.0/0 md5
host all all ::/0 md5
</code></pre>
<p>除此之外,您还可以检查<code>postgresql.conf</code>(/etc/postgresql/9.3/main)/postgresql.conf)检查其他postgres配置是否符合您的预期,如端口号等。在配置文件的下面一行添加以接受所有连接</p>
^{pr2}$
<p>您需要重新启动postgres服务以获取更改</p>
<pre><code>sudo service postgresql restart
</code></pre>
<p><a href="https://www.postgresql.org/docs/9.1/static/auth-pg-hba-conf.html" rel="nofollow noreferrer">https://www.postgresql.org/docs/9.1/static/auth-pg-hba-conf.html</a>
<a href="https://www.postgresql.org/docs/9.1/static/runtime-config-connection.html" rel="nofollow noreferrer">https://www.postgresql.org/docs/9.1/static/runtime-config-connection.html</a></p>