Solution to 2003 when connecting to navicat:
(1) Check which ports are open netstat -anp
127.0.0.1:3306 -- means that the mysql database can only be accessed locally;
(2) We put 127.0.0.1: 3306 is changed to 0.0.0.0:3306, so that all users can remotely access the mysql database;
Open/etc/mysql/mysql.cnf
Findbind- address= 127.0.0.1
Change it to bind-address= 0.0.0.0
(mysql5.7.24 version, the configuration file directory is: /etc/mysql/ mysql.conf.d/mysqld.cnf
)
Restart takes effect;
Command:service mysql restart
(3) After executing the second step and testing to connect to mysql, an error will still be reported: "1130 is not allowed to connect to this MySql server". This is because permissions are not enabled.
Execute under the linux server:
1.mysql -u root -p
Press Enter, enter the password and press Enter, log in;
2. Authorize remote user login
1. Authorize all root users:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root user Password' WITH GRANT OPTION;
2. Authorize the root user of the specified IP:
GRANT ALL PRIVILEGES ON *.* TO root@'specified IP address' IDENTIFIED BY 'root user password' WITH GRANT OPTION;
3. You can also authorize the specified table, which is not so troublesome. Anyway, you can use it locally.
3. Reload the authorization table: FLUSH PRIVILEGES;
4.exit
ExitMysql
(4) Test the connection and the connection is successful.
Recommended tutorial: "navicat tutorial"
The above is the detailed content of Solve the problem of 2003 when connecting to navicat. For more information, please follow other related articles on the PHP Chinese website!