百度了一下说是要修改max_allowed_packet 参数,查看mysql的max_allowed_packet 参数:
show global variables like 'max_allowed_packet';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
可以看到是1
M,然后调大为512M(1024 x 1024 x 512)
set global max_allowed_packet=536870912
show global variables like 'max_allowed_packet';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 536870912 |
+--------------------+---------+
注意:
使用set global命令修改 max_allowed_packet 的值,重启mysql后会失效,还原为默认值。
如果想重启后不还原,可以打开 my.cnf 文件,添加 max_allowed_packet = 512M 即可。