Local can not connect to the remote server (Host is not allowed to connect to this MySQL server) solution

Problem Description:

1. The remote server has installed the mysql service and started it successfully, and can perform operations such as free access and update locally.
2. The server has opened the permission to remotely access server port 3306 and check that 3306 is in the process of monitoring through the netstat -ltnp command.
3. Remotely linking the mysql database through tools will report the error that Host ' xxx.xxx.xxx.xxx ' (local ip) is not allowed to connect to this MySQL server

Solution:

1. To connect to the server remotely, execute ./mysql -u root -p under the /bin file in the mysql system directory in the server; enter the password to log in to mysql; 2. Execute the use
mysql command in mysql to enter the system database
3. In mysql Execute select host from user where user = 'root' in the database; if the returned result is as shown in the figure below:
The return value indicates that the root user is restricted to access in the current host environment
the result indicates that the current root user is restricted to access within the current intranet ip, and his access domain needs to be modified.
4. Execute update user set host = '%' where user = 'root' in the mysql database;
5. After the execution is complete, restart the mysql database by commanding service mysql restart, or restart MySQL in the local service.

Guess you like

Origin blog.csdn.net/Youning_Yim/article/details/109351077