Mysql database connection error: is not allowed to connect to this mysql server

is not allowed to connect to this MySQL server

The mysql database installed on the server reports an error when connecting locally: is not allowed to connect to this MySQL server

 

This happens because:

The mysql database only allows the local machine where it is connected, and does not allow remote connections.

solve:

Log in to the mysql database on the server where mysql is located:

mysql -u root -p

Enter into the mysql database:

use mysql;

select host from user where user='root';

 

You can see that the value of host in the data result obtained by executing the query statement is localhost

We execute the update statement to modify the permissions

update user set host = '%' where user ='root';

 Then refresh the configuration

flush privileges;

As shown in the figure, you can see that the modification has been successful

Then we connect again

 

 

Guess you like

Origin blog.csdn.net/weixin_42599091/article/details/125224850