host 192.168.1.152 is not allowed to connect to this MySQL server

message from server: "Host ‘192.168.1.152’ is not allowed to connect to this MySQL server

在连接本机的mysql 数据库时,配置连接信息,连接发生错误,
message from server: "Host '192.168.1.152' is not allowed to connect to this MySQL server

But changing the IP address to localhost can connect to the MySQL database normally.

Solution:

Execute the following command in Navicat

select host from user where user = 'root'

It is found that the value of host is localhost,
so it is necessary to modify its value:

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

After the modification is completed, execute

flush privileges

The modified content will take effect. When you configure it again, you can connect to the MySQL database normally with the IP address or localhost.

Guess you like

Origin blog.csdn.net/qq_40145879/article/details/106838193