云服务器上搭建的mysql在远端登录时报is not allowed to connect to this MySQL server
时处理步骤:
- 在云主机上登录mysql
mysql -u root -p
- 按以下步骤执行操作即可
> use mysql;
## 查询结果显示当前只能本机登录
> select host from user where user='root';
+-----------+
| host |
+-----------+
| 127.0.0.1 |
| localhost |
+-----------+
## 修改允许远程登录
> update user set host = '%' where user ='root';
## 再次查询结果显示已允许远程登录
> select host from user where user='root';
| host |
+-----------+
| % |
| 127.0.0.1 |
+-----------+
## 刷新配置立即生效
> flush privileges;