1、背景
我在阿里云的ecs安装好了mysql,并且已经安装成功了,我使用navcat客户端连接自己的mysql的时候,却报错:1130 - Host '36.161.238.56' is not allowed to connect to this MySQL server
2、解决
2.1 在服务器终端使用命令行登录mysql
mysql -u root -p2.2 更改root用户的Host为%
- 查看当前所有数据库:show databases;

- 进入mysql数据库:use mysql;

- 查看mysql数据库中所有的表:show tables;
 查看user表中的数据:select Host, User from user;
 查看user表中的数据:select Host, User from user;

- 修改user表中的Host: update user set Host='%' where User='root';

2.3 使权限生效
flush privileges; 
 
2.4 结果成功截图




















