ERROR 2003 (HY000): Can’t connect to MySQL server ‘ip’ (10038)服务器
查看错误类型(Linux系统)tcp
perror 113
结果以下:
OS error code 113: No route to hostspa
致使此错误的缘由为服务器端防火墙未开放MySQL程序使用的端口,默认为3306,开放端口便可rest
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
保存设置并重启防火墙code
service iptables save service iptables restart
防火墙server
开启: service iptables start
关闭: service iptables stop ip
长久开关闭防火墙get
开启: chkconfig iptables on
关闭: chkconfig iptables off it
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT #开启3306端口io
/sbin/iptables -A INPUT -p tcp --dport 80 -j ACCEPT #开启80端口
/sbin/iptables -A INPUT -p tcp --dport 22 -j ACCEPT #开启22端口
个人本机是Ubuntu 只输入了上面的命令就能够打开了
/etc/rc.d/init.d/iptables save #保存配置
/etc/rc.d/init.d/iptables restart #重启服务
查看已开放端口
/etc/init.d/iptables status
结果以下
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80