One - One Code All

Blog Content

一文解决 MySQL / MySQL8 中的 Packets out of order 问题

MySQL Linux-Mac   2021-06-01 08:59:23

出现这个问题的原因是: SQL 语句的 packets 超过了 MySQL 配置的值。


我们可以通过下面的语句来查询当前的 packets 值


show variables like 'max_allowed_packet'

而解决办法也很简单


SQL 语句设置全局的状态 ( 64M)

set global max_allowed_packet = 64*1024*1024

如果存在 /etc/my.cnf 则编辑 my.cnf 添加以下选项

max_allowed_packet= 1M

重启 MySQL 服务器



上一篇:阿里云安装mariadb
下一篇:mysql8 内存优化

The minute you think of giving up, think of the reason why you held on so long.