null, message from server: “Host ‘192.168.170.1‘ is not allowed to connect to this MySQL server“

报错信息

远程连接MySQL报错:java.sql.SQLException: null, message from server: "Host '192.168.170.1' is not allowed to connect to this MySQL server"

报错原因

因为没有启动远程访问权限导致的,只需要开启远程访问权限就可以了

报错解决

进入MySQL开启远程服务

进入mysql数据库

null, message from server: “Host ‘192.168.170.1‘ is not allowed to connect to this MySQL server“_第1张图片

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

 null, message from server: “Host ‘192.168.170.1‘ is not allowed to connect to this MySQL server“_第2张图片

 再重启MySQL服务使其生效

service mysqld restart

你可能感兴趣的:(报错问题,java,android,开发语言)