Анд*_*рев 7 postgresql database-connection database-server
我的 PostgreSQL 出现错误:
SQLSTATE[08006] [7] 无法连接到服务器:连接被拒绝 服务器是否在主机“localhost”(::1) 上运行并接受端口 5432 上的 TCP/IP 连接?无法连接到服务器:连接被拒绝 服务器是否在主机“localhost”(127.0.0.1) 上运行并接受端口 5432 上的 TCP/IP 连接?
以下命令不显示 5432 端口已打开:
sudo netstat -plunt |grep postgres
Run Code Online (Sandbox Code Playgroud)
我猜问题出在 5432 端口,所以我在netstat.
如何为 PostgreSQL 打开端口?
postgresql.conf都pg_hba.conf可以(见下文)。postgres服务器正在运行postgresql.conf文件:sudo netstat -plunt |grep postgres
Run Code Online (Sandbox Code Playgroud)
pg_hba.conf文件:listen_addresses = '*'
port = 5432
Run Code Online (Sandbox Code Playgroud)
$ netstat -atuActive Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:6379 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:http 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:https 0.0.0.0:* LISTEN
tcp 0 0 30secondboomer.com:ssh 109-252-90-59.nat:11807 ESTABLISHED
tcp 0 0 30secondboomer.com:ssh 109-252-90-59.nat:11258 ESTABLISHED
tcp 0 0 30secondboomer.com:ssh 109-252-90-59.nat:11797 ESTABLISHED
tcp6 0 0 localhost:6379 [::]:* LISTEN
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 [::]:https [::]:* LISTEN
udp 0 0 localhost:domain 0.0.0.0:*
udp 0 0 30secondboomer.c:bootpc 0.0.0.0:*
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
54966 次 |
| 最近记录: |