MySQL报错:Packet for query is too large (4,544,730 > 4,194,304). 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的max_allowed_packet大小,运行
show VARIABLES like '%max_allowed_packet%';
- 可能不会立即生效,可以关闭命令行重新打开