Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1314 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.
MySQL根据配置文件会限制Server接受的数据包大小
。有时候大的插入和更新会受 max_allowed_packet 参数限制,导致写入或者更新失败。
查看目前配置:
show VARIABLES like '%max_allowed_packet%';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
以上说明目前的配置是:1M
1.修改配置文件:my.cnf在[mysqld]段或者mysql的server配置段进行修改
max_allowed_packet = 20M
2.在mysql命令行中修改
set global max_allowed_packet = 2*1024*1024*10