Android连接数据库,MySQL报错:W/System.err: java.sql.SQLException: null,  message from server: "Host 'WIN-BFHI27MPO93' is not allowed to connect to this MySQL server"

原因是:远程服务器不允许你的java程序访问它的数据库。

解决步骤:

1、打开mysql控制台,输入:use mysql;

2、输入:show tables;

3、输入:select host from user;

    user为root,host为localhost的话,说明mysql只允许本机连接

4、输入:update user set host ='%' where user ='root';

5、执行刷新权限,输入:flush privileges;

相关文章:

  • 2021-09-27
  • 2021-07-17
  • 2021-11-12
  • 2021-05-11
  • 2021-04-12
  • 2022-01-10
  • 2021-09-27
  • 2021-10-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案