Java null, message from server: “Host ‘xxx‘ is not allowed to connect to this MySQL server“文件解决

问题描述:

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

问题分析:

1、root用户只能使用localhost连接,不能使用局域网或外网IP连接。

解决办法:

第一步,进入sql。

第二步,输入use mysql;,选择数据库。

第三步,输入 update user set host='%' where user='root';,修改root用户的权限范围。

第四步,输入flush privileges;,将权限更新操作刷新到内存中。

猜你喜欢

转载自blog.csdn.net/qq_38974638/article/details/114939689