Date: November 17, 2017
Problem: error in remote connection to MySQL database: 2003 can’t connect to MySQL server on ” (10060)
Reason: the alicloud console does not open port 3306 in the instance security group
How to discover: discovered when using Navicat to connect to remote database
Repair: open the alicloud console and add port 3306 to the instance security group
In which files have been modified: the alicloud console has been modified
I lead to: No
Bug resolution time: 2 hours
Lesson: because I was just beginning to learn Java, I didn’t think that it was a problem on the Alibaba cloud server console when this problem occurred. I checked a lot of information on the Internet, There are three similar solutions: 1. Port 3306 is not opened on the remote server; 2. Your IP is not authorized to log in to the remote database (or your database account refuses to log in remotely); 3. The network is blocked
The solution to the first problem is:
Opening port 3306 in iptables
#/sbin/iptables-IINPUT-ptcp–dport3306-jACCEPT
#/Etc/rc.d/init.d/iptablessave:
#Service iptables restart takes effect
The second solution is:
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
The third is not explained
(another way is to turn off the server firewall:
#
This method is not recommended for serviceiptables stop, which may cause unknown security problems.)
Obviously, it didn’t solve the problem in the end. A lot of information on the Internet is repetitive. In the end, there is no way. I found that it was the problem on the Alibaba cloud console with the help of my elder martial brother. It shows that I’m still thinking in the wrong direction
Open ECS
Open an instance of the menu on the left
Open the management on the far right of the instance
Open the security group of this instance in the menu on the left
Open the configuration rule on the right
Add security group rule in upper right corner
The protocol type is customized by default, the port range is 3306/3306, the authorization object is 0.0.0.0/0, and others are OK by default
Confirm and restart the server
Connect OK!
Similar Posts:
- Remote connection with Navicat mysql:Can ‘t connect to MySQL server (10060)
- [Solved] MYSQL ERROR 2003 (HY000): can’t connect to MySQL server (10060)
- [Solved] SQLSTATE[HY000] [2003] Can’t connect to MySQL serv
- When Navicat connects to a database on a server, there is an error prompt: 1130 ‘* *’ host is not allowed to connect to this MySQL server
- [SVC] Online Iptables Restart error: Couldn’t load target `ACCET’:/lib64/xtables/libipt_ACCET.so: cannot open shared object file: No such file or directory
- FileZilla client connects to the pagoda on Alibaba cloud server, and FileZilla server appears [response: 425 can’t open data connection for transfer of ‘/]
- The solution of 2003 can’t connect to MySQL server on ‘localhost’ (10061)
- [Solved] CentOS 7.2 Startup Error: Failed to start IPv4 firewall with iptables
- [Solved] MySql Host is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts…
- [Solved] 2003 – cant connect o mysql server on xxx (10060 unknown error)