java.sql.SQLException: null, message from server: “Host ‘xxx.xx.xxx.xxx‘ is not allowed to connect

1. 连接服务器,进入到mysql中。

mysql -u root -p

2. 查看root用户信息。

 use mysql;

 select user,host from user;

 

3. 表中root用户只能localhost访问,现在需要修改root用户ip访问限制,即允许所有ip访问。

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

 

host=% 允许所有ip地址访问。 

4. 将权限更新操作刷新到内存中,不用下次启动的时候生效。

flush privileges;

猜你喜欢

转载自blog.csdn.net/hay23455/article/details/134580626