There are 2 ways to resolve this issue:
localhost changed to%
1. Go to the MySQL bin directory
Note: Root is the administrator user name, password is the user root password:
Mysql-u root-p Password
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ' and host = ' localhost ';
Mysql>flush privileges;
Note: The MySQL client connecting to this server needs to be restarted and then connected to this server.
Specific analysis
1, after the computer log in MySQL, the "MySQL" Database in the "User" table "host", from "localhost" to the '% '.
Mysql>
Mysql>use MySQL;
Mysql>select ' host ' from user where user= ' root ';
#查看mysql库中的user表的host值 (Host/IP name for connection access)
A different approach
If you are using the client software, we can use the client software on the MySQL server to enter, in the Query Analyzer input: (Note that you must be a root user login oh, otherwise it is not modifiable)
Use MySQL;
SELECT * from user where user= ' root ';
In the query results (only one) directly modify the host column value, changed from localhost to #, click Apply to run can be modified. Then reboot the client and reconnect.
Or:
Use MySQL;
Update user Set host = '% ' where user = ' root ' and host= ' localhost '
Then reboot the client and reconnect.
zbb20170811 MySQL Remote connection error: Host * isn't allowed to connect to this MySQL server, workaround