Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 设置博士后:Can';t远程连接到Postgres服务器(debian)_Postgresql_Debian - Fatal编程技术网

Postgresql 设置博士后:Can';t远程连接到Postgres服务器(debian)

Postgresql 设置博士后:Can';t远程连接到Postgres服务器(debian),postgresql,debian,Postgresql,Debian,我在从外部服务器连接数据库时遇到问题。我读了很多关于这个主题的话题。什么都没有 Trying 127.0.0.1... Connected to localhost.localdomain. Postgresql 8.4/Debian Trying 127.0.0.1... Connected to localhost.localdomain. My/etc/postgresql/8.4/main/postgresql.conf: listen_addresses = '*' port =

我在从外部服务器连接数据库时遇到问题。我读了很多关于这个主题的话题。什么都没有

Trying 127.0.0.1...
Connected to localhost.localdomain.
Postgresql 8.4/Debian

Trying 127.0.0.1...
Connected to localhost.localdomain.
My/etc/postgresql/8.4/main/postgresql.conf

listen_addresses = '*'
port = 5432
max_connections = 100
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 trust
Trying 127.0.0.1...
Connected to localhost.localdomain.
My/etc/postgresql/8.4/main/pg_hba.conf

listen_addresses = '*'
port = 5432
max_connections = 100
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 trust
Trying 127.0.0.1...
Connected to localhost.localdomain.
netstat-nlp | grep5432

tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN    6520/postgres
tcp6       0      0 :::5432                 :::*                    LISTEN    6520/postgres
unix  2      [ ACC ]     STREAM     LISTENING     15338180 6520/postgres       /var/run/postgresql/.s.PGSQL.5432
Trying 127.0.0.1...
Connected to localhost.localdomain.
telnet localhost 5432

Trying 127.0.0.1...
Connected to localhost.localdomain.
但是当我尝试从我的计算机连接时,我总是得到“无法建立到的连接”

Trying 127.0.0.1...
Connected to localhost.localdomain.

知道我做错了什么吗?:/感谢您的帮助:)

您是否在运行postgres的服务器上禁用了防火墙?
Trying 127.0.0.1...
Connected to localhost.localdomain.

如果没有,请禁用并测试。如果您能够在禁用防火墙后进行连接,则需要打开防火墙中的端口5432。

检查IPTABLES,确保其未运行:

Trying 127.0.0.1...
Connected to localhost.localdomain.
iptables -L

Trying 127.0.0.1...
Connected to localhost.localdomain.

如果它正在运行且默认规则已就位,则可能会导致问题。

可能是与IPv6相关的问题,请尝试通过使用
-h
显式添加服务器的ipv4地址来远程连接
Trying 127.0.0.1...
Connected to localhost.localdomain.