Tag Archives: mysql:Can’t connect to MySQL server (10060)

Remote connection with Navicat mysql:Can ‘t connect to MySQL server (10060)

Front end developers must read! Starting from scratch, teach you to build a low code website platform in stages>>>

There are two reasons for this phenomenon, one is that the current user is rejected by the MySQL server, the other is that port 3306 is banned by the firewall and cannot be connected to the port. The solution is as follows:

1. Set remote user access rights:

//Any remote host can access the database

mysql> GRANTALLPRIVILEGESON*.*TO’root’@’%’WITHGRANTOPTION;

//You need to enter a command for the modification to take effect

mysql> FLUSHPRIVILEGES;

//Exit

mysql> EXIT

Sometimes it’s easy to develop ports on the alicloud console

After entering iptables, we found that port 3306 is not open, so we can only tap it in iptables with our hands

2. Open port 3306 in iptables

#/SBIN/iptables iinput PTCP — dport3306-j accept
Restart service

However, this is not recommended as it can cause security issues

  

Note: sometimes it’s not easy to add a port to the console. You might as well go into iptables to see if you really add rules