连接MySQL错误 Can't connect to MySQL server 10060

               

使用图形界面管理工具Navicat for MySQL连接Mysql数据库时提示错误:Can't connect to MySQL server (10060)


问题原因:

导致些问题可能有以下几个原因:

1、网络不通;

2、服务未启动;

3、防火墙端口未开放;

解决方法:

启动服务:

service mysqld start;

经过分析,我遇到的这个问题是防火墙导致的!

开放防火墙端口
 添加需要监听的端口
 /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

 保存设置
 /etc/init.d/iptables save

 查看状态
 /etc/init.d/iptables status

 临时关闭防火墙服务
 service iptables stop

 开启防火墙服务
 service iptables start

 开机不再启动防火墙服务
 chkconfig iptables off

注意:
 此文档适用服务器环境为:CentOS 6.5  MySQL 5.6


如果是Java程序连接不上数据库,请参考:Connections could not be acquired from the underlying database


           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

猜你喜欢

转载自blog.csdn.net/qq_43682896/article/details/86906890
今日推荐