Navicat远程连接mysql,报错:can't connec

2018-04-25  本文已影响0人  MissTomatoo

问题描述:Windows下用Navicat for MySQL远程连接,报错:can't connect to mysql server on 'XXX'(10060)

环境:Linux6.5+mysql5.7

去网上搜索,原因可能有:

a、bind-address 对于连接的ip做了一个限定

b、数据库用户只能在指定的ip上连接

c、网络,防火墙可能导致的问题

针对后两种解决方法进行了尝试:

1、用户权限

查询root用户的权限:select host,user from user;

发现root用户是所有IP都可以连接的

2、防火墙

(1)查看本机防火墙,发现是关闭的状态

(2)查看Linux虚拟机的防火墙状态

a、chkconfig|grep iptables 查看是否有iptables的服务(备注:chkconfig命令检查、设置系统的各种服务)

b、chkconfig iptables off  关闭开机自启动(备注:chkconfig iptables on  开启开机自启动)

c、chkconfig --del iptables 移除开机自启动(备注:chkconfig --add iptables 增加开机自启动)

d、chkconfig|grep iptables 再次查看iptables服务,发现没有了

e、iptables -L  列出所有规则

f、iptables -F  清除所有规则

g、iptables -L  上次看到的规则已删除

再次用Navicat连接,成功!

上一篇下一篇

猜你喜欢

热点阅读