Navicat 报 1130 - Host XXX is not allowed to connect to this MySQL server 错误提示的解决办法

在这里插入图片描述

  1. 用Navicat Premium 11.1.13连接云服务器的数据库时报错
    报错原因:此时的MySQL配置不支持远程连接 。
  2. 登陆服务器,进入数据库 mysql -uroot -p
use mysql;

select host from user where user='root';

在这里插入图片描述

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

将localhost设置为通配符%,localhost设置了“%”后便可以允许远程访问。

‘localhost’ 指的是用户开放的IP,可以是’localhost’(仅本机访问,相当于127.0.0.1),可以是具体的’...’(具体某一IP),也可以是 ‘%’ (所有IP均可访问)

  • 刷新权限
flush privileges;

查看配置

 select host from user where user='root';

在这里插入图片描述
完成后,就可以连接成功了。

发布了208 篇原创文章 · 获赞 27 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/qq_41684621/article/details/104232456