原文地址:https://blog.csdn.net/qq_42093488/article/details/80468069
Packet for query is too large (6071393 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
批量插入数据量过大,解决办法
修改 my.ini 加上 max_allowed_packet =67108864
67108864=64M
默认大小4194304 也就是4M
修改完成之后要重启mysql服务,如果通过命令行修改就不用重启mysql服务。
命令修改:(即时生效)
正确写法:
设置为500M
mysql> set global max_allowed_packet = 500*1024*1024;
或者
mysql> set global max_allowed_packet = 524288000;
查看mysql的max_allowed_packet大小,运行
show VARIABLES like '%max_allowed_packet%';