mysql java连接异常及断开解决秘籍
3、The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
统一加上autoReconnect=true&failOverReadOnly=false,如果是mysql 8.0,额外加上useSSL=false&serverTimezone=Asia/Shanghai。
JDBC加上验证
validationQuery=SELECT 1
testWhileIdle=true
testOnBorrow=true
testOnReturn=true
4、The last packet successfully received from the server was 1,583 milliseconds ago. The last packet sent successfully to the server was 1,583 milliseconds ago.
timeBetweenEvictionRunsMillis=300000
minEvictableIdleTimeMillis=3600000
removeAbandoned=true
removeAbandonedTimeout=180000
logAbandoned=true
4、5 https://www.cnblogs.com/zhjh256/p/6591294.html
5、ERROR : (2006, 'MySQL server has gone away'),通常答案就https://www.cnblogs.com/fnlingnzb-learner/p/5984795.html这么几个,1、服务器真的挂了;2、超时了(如果经过mycat,可能是mycat到mysql的连接已经超时了);3、网络真的很不稳定。
6、2013 Lost connection to MySQL server at 'waiting for intial communication packet',system error:0 设置参数skip-name-resolve
https://dev.mysql.com/doc/refman/5.7/en/common-errors.html
1、使用最新版本的mycat,1.3、1.4 bug较多,比如com.mysql.jdbc.PacketTooBigException: Packet for query is too large (60 > -1),参见https://www.cnblogs.com/zhjh256/p/9229568.html
1.1、对于mycat,默认的查询超时时间300秒,如果时间很长,前端可能会出现错误"???",同时后台取消执行还是继续执行??
可以在server.xml中调整,如下:
<system>
<!--sql超时,单位秒-->
<property name="sqlExecuteTimeout">1800</property>
</system>
建议和mysql服务器的xxx相同。
<property name="maxPacketSize">1073741824</property>
建议和mysql服务器的xxx相同。
<property name="idleTimeout">180000</property>
建议和mysql服务器的xxx相同。
<property name="txIsolation">READ-COMMITTED</property>
建议和mysql服务器的xxx相同。
其他可https://www.cnblogs.com/kingsonfu/p/10627285.html
2、使用最新版本的mysql connector
7、mysql各超时参数时间足够长
interactive_timeout,默认28800,比wait_timeout具有更高的优先级,典型的交互式连接就是mysql自带的客户端,其他是C客户端为主。
wait_timeout,默认28800,等待非交互式连接的时间
net_read_timeout,等待下一个数据包发送的时间阈值,除了WAN和网络特别堵,基本不会发生
net_write_timeout,等待下一个数据包到来的时间阈值,除了WAN和网络特别堵,基本不会发生
mysql、mycat配置都正确,但是delete长时间执行时报下列错误:
mycat.log没有内容生成,wrapper.log大量下列错误:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
2018-10-09 c++ kafka 客户端rdkafka报Receive failed: Disconnected问题原因以及解决方法
2018-10-09 zookeeper各种报错、原因及解决方法汇总(持续更新)