300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > SQLException:null message from server: “Host ‘xx‘ is not allowed to connect to this MySQL server“

SQLException:null message from server: “Host ‘xx‘ is not allowed to connect to this MySQL server“

时间:2022-04-06 18:26:34

相关推荐

SQLException:null  message from server: “Host ‘xx‘ is not allowed to connect to this MySQL server“

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

以上报错信息为,当前登录的mysql账号没有访问权。只能使用'localhost'或'127.0.0.1'访问,使用本地电脑的IP地址也是不可以访问的。

解决思路:

修改当前登录的mysql账号的访问权限

#登录mysql

mysql -u账号-p密码

#登录成功之后进入mysql数据库

use mysql

#查询user表

select user,host from user;

#修改当前root账号的访问权限

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

#刷新

flush privileges;

#再次查询

select user,host from user;

经过以上的操作,再次启动项目这个问题就解决了!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。