【MySQL】解决java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect

操作步骤如下:

1、登录
命令行如下:

mysql -u root -p

2、输入原密码
根据Enter password:提示输入密码

3、执行

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

4、执行

flush privileges;

5、执行

use mysql;

6、执行

select host,user from user;

在这里插入图片描述

显示%就代表修改好了,错误也就解决了。

猜你喜欢

转载自blog.csdn.net/qq_44921056/article/details/131425992