For Navicat connecting to the database mysql, an error 2003 (10060) occurs, as shown below
After querying and summarizing the above problems, there are three main solutions:
1. The MySQL service is not started. This is the most common cause of the problem.
WIN+R, enter services.msc to open the service manager, find mysql,
if it shows that mysql is disabled, you can right-click to start the service, and then retest the connection in Navicat
2. MySQL does not have remote permissions
1) View permissions
Check the relevant information of the current root user, whether there is remote permission, as shown in the figure below, if the host of the root user is localhost, it means that only local access is supported, and remote access is not allowed. Need to change to %
//登录mysql
mysql -u root -p;
//选择mysql数据库
use mysql;
//查看user表
select host, user, authentication_string, plugin from user;
2) Modify permissions
If it is a version before mysql8.0
mysql -u root -p #进入MySQL数据库后进行一下操作。
mysql> use mysql;
mysql> grant all privilegs on *.* to 'root'@'%' identified by 'root用户密码' with grant option;
mysql> flush privileges;
If it is mysql8.0 or above
mysql> update user set host = '%' where user = 'root';
mysql> flush privileges;
3. Firewall interception
Open Windows Settings, select Update & Security
Select Windows Security Center, then Firewall and Network Protection
Open Advanced Settings
Inbound rules on the left, then click New Rule on the right, select the port, and then click Next.
Specific local port, fill in 3306, other defaults are not modified, click Next. Default
is not modified, click Next.
Default is not modified, click Next
Fill in the name and description, choose the name yourself, and click Finish.