连接mysql -- host is not allowed to connect to this mysql server的解决

今天通过navicat连接服务器的MySQL,报错:

host is not allowed to connect to this mysql server

去网上搜了一摞,有些方法不太管用,踩了点坑,在此记录下。

版本:MYSQL 8.0.36, CentOS 7

mysql -u root -p
use mysql;
select user, host from user;

这时候可以看到:只允许localhost

直接改权限:

update user set host='%' where user='root';
flush privileges;
select user, host from user;

此时可看到host已修改,navicat成功连接:

posted @ 2024-04-23 21:31  silomen  阅读(336)  评论(0)    收藏  举报