At that time, I wanted to use
SQLyog to remotely connect to the database, but found that I could not connect, and the following error occurred:
error:1130 Host:'xx.xx.xx.xx' is not allowed to connect to this MySQL server
This error is because your MySQL database does not have remote access permissions.
mysql -uroot -p
select host,user from user where user='root';
It is found that there are two users corresponding to two host values.
If you use the change statement
update user set host='%' where user='root';
There will be an error like the title:
MySql ERROR 1062 (23000): Duplicate entry ‘%-root‘ for key ‘PRIMARY‘
This is because there are two host attributes corresponding to user
We delete one of the hosts
delete from user where host='127.0.0.1';
Use the query statement to find that there is only one left:
Use the update statement, success!
Successful external connection