当前位置:Gxlcms > 数据库问题 > java.sql.SQLException: null, message from server: "Host 'XXX' is not allowed to connect to this MySQL server"

java.sql.SQLException: null, message from server: "Host 'XXX' is not allowed to connect to this MySQL server"

时间:2021-07-01 10:21:17 帮助过:21人阅读

技术图片

 

 原因是:远程服务器不允许你的java程序访问它的数据库。所以,我们要对远程服务器进行设置,使它允许你进行连接。

解决步骤

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

技术图片

 

 2、输入:show tables;

3、输入:select host from user;

技术图片

 

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

 5、重启服务就可以连上了

 

java.sql.SQLException: null, message from server: "Host 'XXX' is not allowed to connect to this MySQL server"

标签:数据   select   show   数据库   mysql   user   sage   步骤   use   

人气教程排行