MySQL:Host ‘host.docker.internal‘ is not allowed to connect to this MySQL server.

1、问题描述?

通过ip地址登录数据库的时候,提示如下问题:

Host 'host.docker.internal' is not allowed to connect to this MySQL server.

翻译:不允许主机“Host.docker.internal”连接到此MySQL服务器。

使用数据库版本:mysql5.7.43

2、解决办法?

2.1、通过cmd登录mysql数据库

登录命令:mysql -uroot -p         :表示以root用户登录

2.2、定位数据库

数据库的系统表在mysql数据库中

use mysql;

查看mysql中user表的数据

我们本质就是希望价格root用户的Host修改成'%'即可。

2.3、修改数据

【1、修改数据】

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

【2、使修改生效】

​​flush privileges;​​

这样就OK啦。

docker-compose部署nacos连接不到mysql at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:104) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:149) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:122) at com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin.nextAuthenticationStep(CachingSha2PasswordPlugin.java:154) at com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin.nextAuthenticationStep(CachingSha2PasswordPlugin.java:49) at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:446) at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:215) at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1428) at com.mysql.cj.NativeSession.connect(NativeSession.java:133) at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:829) ... 79 common frames omitted Caused by: com.mysql.cj.exceptions.UnableToConnectException: Public Key Retrieval is not allowed at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85) at com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin.nextAuthenticationStep(CachingSha2PasswordPlugin.java:131) ... 85 common frames omitted 2025-09-02 17:41:22,840 ERROR Nacos failed to start, please see /home/nacos/logs/nacos.log for more details. 2025-09-02 17:41:22,904 INFO [ThreadPoolManager] Start destroying ThreadPool 2025-09-02 17:41:22,905 INFO [ThreadPoolManager] Completed destruction of ThreadPool
最新发布
09-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

雾林小妖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值