MySQL如何解决Host is not allowed to connect to this MySQL server

在运行Android studio时,日志中报错Host is not allowed to connect to this MySQL server,就是MySQL权限没有受理

 

解决方案:1、登录MySQL控制台:在电脑下方搜索

 

2、选择上图中Unicode

3、输入MySQL密码

4、根据命令

mysql> use mysql;

Database changed
mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

5、关闭后,重新运行app,即成功
posted @ 2024-03-31 21:13  不会JAVA的小袁  阅读(1156)  评论(0)    收藏  举报