mysql链接异常,不能使用ip链接解决——null, message from server: "Host 'host.docker.internal' is not allowed to connect to this MySQL server"

发布时间 2023-12-21 17:11:33作者: 渝思

情况:
报错翻译:​
空指针,来自服务器的消息:​"Host ’ Host .docker.internal’​ 不允许连接到 ​MySQL​ 服务器"

登陆mysql
键入命令mysql -uroot -p,回车后提示你输入密码,输入12345,然后回车即可进入到mysql中

选择数据库
use mysql
查询root用户的host
select user,host from user;
修改root的host为%
update user set host='%' where user='root';
刷新修改
然后 ​​flush privileges;​​ 使之生效。