700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > could not connect to server: Connection timed out (Ox0000274C/10060)ls the server running on host “

could not connect to server: Connection timed out (Ox0000274C/10060)ls the server running on host “

时间:2020-06-08 09:10:03

相关推荐

could not connect to server: Connection timed out (Ox0000274C/10060)ls the server running on host “

PostgreSQL安装后Navicat客户端连接报错如下:

主要注意两个方面:是否开启了远程访问、是否开启了防火墙或配置了防火墙白名单。

检查是否开启了远程访问

1、修改/var/lib/pgsql/10/data/postgresql.conf文件,取消 listen_addresses 的注释,将参数值改为“*”

2、修改/var/lib/pgsql/10/data/pg_hba.conf文件,增加下图红框部分内容

3、切换到root用户,重启postgresql服务

systemctl restart postgresql-10.service

检查是否开启了防火墙或配置了防火墙白名单

4、检查防火墙是否开启,开启后需要将postgres端口5432添加到防火墙白名单,或者关闭防火墙,两种方案均可,执行一种即可。一般服务器上防火墙不动它,即它开着就开着,添加白名单即可。如果是测试

(1)添加防火墙白名单

--查看防火墙状态,如下则表示防护墙开启着的

iptables -nvL

--添加5432端口到防火墙白名单中

firewall-cmd --add-port=5432/tcp --permanent

--使配置端口生效

firewall-cmd --reload

(2)关闭防火墙

2.1.查看防火墙状态

systemctl status firewalld

firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

2.2.查看防火墙是否开机启动

systemctl is-enabled firewalld

2.3.关闭防火墙

systemctl stop firewalld

systemctl stop firewalld.service

systemctl status firewalld

2.4.禁用防火墙(系统启动时不启动防火墙服务)

systemctl disable firewalld

systemctl disable firewalld.service

systemctl is-enabled firewalld

问题搞定 使用数据库连接工具测试连接成功

本文参考了对应文章,多谢大神:

CentOS安装PostgreSQL - 玄同太子 - 博客园 ()

(4条消息) PostgreSQL安装后Navicat客户端连接报错:could not connect to server:Connection timed out_MrZhang的博客-CSDN博客

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。