今天打开psql的时候出现这个错误

psql: could not connect to server: Connection refused (0x0000274D/10061)

Is the server running on host “localhost” (::1) and accepting

TCP/IP connections on port 5432?

could not connect to server: Connection refused (0x0000274D/10061)

Is the server running on host “localhost” (127.0.0.1) and accepting

TCP/IP connections on port 5432?

解决如下

这个问题一般是以下原因造成的:

1.服务器没起来,ps -ef|grep postgres查看是否存在PG进程

2.监听问题,cat postgresql.conf|grep listen 查看监听地址端口是否正确

3.服务端超级用户能进去,其他用户不行,检查是否超出最大连接数限制

4.以上都没问题,服务器端能连进去,但客户端不行,这时需要查看pg_hba.conf文件

5.以上都没问题,检查服务器端的iptables,开启防火墙的访问端口

最后发现端口不是默认的5432,修改即可。

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐