1.全过程如下:
然后success以后,再次连接navicat已可连接成功。
--
这是在用Navicat连接MySQL遇到10038错误的时候,发现3306端口未开放。
另外,如果使用的是阿里云,需要在阿里云控制台开启3306端口的策略。
-
2.开启centos7的防火墙(并开机自启):
[root@www~]#systemctllist-unit-files|grepfire//查看状态
firewalld.servicedisabled
[root@www~]#systemctlenablefirewalld.service//设置自启
Createdsymlinkfrom/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.serviceto/usr/lib/systemd/system/firewalld.service.
Createdsymlinkfrom/etc/systemd/system/basic.target.wants/firewalld.serviceto/usr/lib/systemd/system/firewalld.service.
[root@www~]#systemctllist-unit-files|grepfire//查看防火墙状态,已经开启了
firewalld.serviceenabled
[root@www~]#reboot//重启centos
3.如果出现打开了3306,navicat可以访问,但是nginx无法访问(浏览器页面显示超时),那是因为80等端口未开启造成的。
我在此手动开启80等常用端口:
<portprotocol="tcp"port="80"/>代表开放80端口。具体如下:
<?xmlversion="1.0"encoding="utf-8"?>
<zone>
<short>Public</short>
<description>Foruseinpublicareas.Youdonottrusttheothercomputersonnetworkstonotharmyourcomputer.Onlyselectedincomingconnectionsareaccepted.</description>
<servicename="ssh"/>
<servicename="dhcpv6-client"/>
<portprotocol="tcp"port="21"/>
<portprotocol="tcp"port="22"/>
<portprotocol="tcp"port="80"/>
<portprotocol="tcp"port="8080"/>
<portprotocol="tcp"port="8090"/>
<portprotocol="tcp"port="3306"/>
</zone>
reboot主机,再次打开页面和navicat,发现都能正常使用。
原文链接:https://blog.csdn.net/weixin_41827162/article/details/98877108