How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server

Environment: mysql5.7.11 + windows10 64-bit
Problem: When using mysql remote login command mysql — uroot — h192.168.1.102-p, ERROR mysql ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this mysql server
The reason for the problem: For security reasons, the mysql server allows only local login to the database server by default.
Fix the problem: After you log in to mysql, change the “host” TAB in the “User” table in the “mysql” database, change the name from “localhost” to “%”, and restart mysql so that all remote machines can access it.
step 1: modify the mysql table
mysql -u root -pvmware
mysql> use mysql;
mysql> update user set host = ‘%’ where user = ‘root’;
mysql> flush privileges;
mysql> select host, user from user;
mysql> quit
Step 2: Restart mysql
Method 1: Find “View Local Services” in Windows Settings, find mysql service, and restart mysql service

Method 2:
Win 7 or XP will start and stop mysql directly from the CMD command line by calling NET stop mysql /net Start mysql.
win8 and above versions need to use administrator privileges to use the CMD command to start the service. The author USES windows10, so you need to find CMD. Exe, right click and select “run as administrator”, and then enter net stop mysql /net start mysql to start and stop the service.

Step 3: Use the remote login command again and the login is successful.

Read More: