Mysql报错java.sql.SQLException:null,message from server:“Host ‘27,45,38,132‘ is not allowed to connect

Mysql连接报错:java.sql.SQLException:null,message from server:"Host ‘27,45,38,132’ is not allowed to connect.
Mysql报错java.sql.SQLException:null,message from server:“Host ‘27,45,38,132‘ is not allowed to connect_第1张图片

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

步骤:一、打开mysql控制台,输入:use mysql;

Mysql报错java.sql.SQLException:null,message from server:“Host ‘27,45,38,132‘ is not allowed to connect_第2张图片

二、输入:show tables;

Mysql报错java.sql.SQLException:null,message from server:“Host ‘27,45,38,132‘ is not allowed to connect_第3张图片

三、输入:select host from user;
Mysql报错java.sql.SQLException:null,message from server:“Host ‘27,45,38,132‘ is not allowed to connect_第4张图片

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

Mysql报错java.sql.SQLException:null,message from server:“Host ‘27,45,38,132‘ is not allowed to connect_第5张图片

五、打开计算机的服务界面,重新启动mysql服务,远程服务器就允许程序连接数据库了。

Mysql报错java.sql.SQLException:null,message from server:“Host ‘27,45,38,132‘ is not allowed to connect_第6张图片

你可能感兴趣的:(Bug解决)