1. Table modification method
It may be that your account is not allowed to log in remotely, but only in localhost. At this time, just log in to MySQL on the computer of localhost, change the “host” item in the “user” table in the “MySQL” database, and change the name from “localhost” to “%”
mysql -u root -pvmwaremysql>use mysql;
mysql>update user set host = ‘%’ where user = ‘root’;
mysql>select host, user from user;
2 authorization law
For example, if you want myuser to connect to the MySQL server from any host using mypassword.
GRANT ALL PRIVILEGES ON . TO ‘myuser’@’%’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
If you want to allow user myuser to connect to the MySQL server from the host with IP 192.168.1.3, and use mypassword as the password
GRANT ALL PRIVILEGES ON . TO ‘myuser’@’192.168.1.3’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
In my mysql.user, the host of the root user is indeed localhost. First change the table method to change the localhost to “%”, but it still doesn’t work. It still reports an error of 1130, and then authorize it according to the method of “connecting to the MySQL server from any host”. It still reports the same error. Finally, after authorizing its own IP, it finally logs in….
Overall, the whole process is roughly
Enter the MySQL database under Linux system, open the user table, find the record with the value of “localhost” in the “host” field, and update the value of “localhost” to “%”.
The command is as follows:
mysql -u root -p
mysql>update user set host=’%’ where user=’root’ and host=’localhost’;
mysql>select host,user from user;
MySQL 1130 error resolution:
This error occurs when connecting to MySQL through MySQL front or MySQL administrator
ERROR 1130: Host ... is not allowed to connect to this MySQL server
This indicates that the connected user account does not have remote connection permission and can only log in on the local machine (localhost).
You need to change the host entry in the user table in the MySQL database
Change localhost to%
Specific steps: log in to MySQL
First, use MySQL;
An error occurs when updating according to the method provided by others.
MySQL> update user set host=’%’ where user = ‘root’;
ERROR 1062 (23000): Duplicate entry ‘%-root’ for key ‘PRIMARY’
Then, the host information of the following database is viewed as follows:
MySQL> select host from user where user = ‘root’;
| host |
| % |
| 127.0.0.1 |
| localhost.localdomain |
3 rows in set (0.00 sec)
Host already has the value% so run the command directly:
Knowledge can be spread only through sharing, new knowledge can be respected, and more can be learned. Each text / blog written here is basically queried from the Internet and then recorded. It is extracted from cnblog. It is the author of 4639526 this user. Thanks for sharing.