连接MySQL数据库时出现The dirver has not received any packets from the server

看到网上很多很多的论坛与博客,终于找到我的错误的原因,先上图吧,

使用Connector/J连接MySQL数据库:Communications link failure,The last packet successfully received from the server was *** millisecond ago.The last packet successfully sent to the server was ***  millisecond ago。 这个错误的话,是因为你超过了MySQL的默认闲置时间,要到mini上面改下参数,但是问题的关键不在我,我的错误是:CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driv
er has not received any packets from the server.

解决方法:把Connetion URL=jdbc:mysql://127.0.0.1:3306/mysong

结论:一般而言,默认情况下,root好像只可以通过localhost访问,ip是不可以的,是没有权限,需要修改myslq配置文件。如果数据库和你部署的服务器是用一台机器,那么使用localhost没有问题,要是不在同一台,可能需要改mysql配置,保证ip可以访问。

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
根据你提供的引用内容,出现 "The driver has not received any packets from the server." 错误是由于MySQL连接导致的。MySQL服务器有一个默认的"wait_timeout"参数,它规定了一个连接的空闲间超过该间后会自动断开连接连接池在判断连接是否有效,并没有校验连接的有效性,因此当应用申请使用已经超连接,就会导致该错误的出现。 为了解决这个问题,你可以尝试以下方法: 1. 修改MySQL的"wait_timeout"参数:在my.cnf文件中,将"wait_timeout"的值增大到适当的间,例如设置为1年(31536000秒)。 2. 检查my.cnf文件的位置:在Ubuntu系统中,默认的my.cnf文件路径可能会有所不同。你可以尝试在/etc/mysql/或/etc/mysql/mysql.conf.d/目录下查找my.cnf文件。如果仍然找不到该文件,你可以创建一个新的my.cnf文件并添加需要修改的参数。 3. 检查MySQL的端口号:如果你重新安装了MySQL,并且遇到了端口号为0的情况,你可以确保端口号被正确设置为3306。 总结一下,你在nacos启动遇到的报错"The driver has not received any packets from the server."是由于MySQL连接导致的。你可以通过修改MySQL的"wait_timeout"参数、确认my.cnf文件的位置以及检查MySQL的端口号来解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [今天遇到一个错误The driver has not received any packets from the server.](https://blog.csdn.net/ShiningSilver/article/details/108473659)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值