MySQL会限制Server接受的数据包大小。有时候插入、更新或查询时数据包的大小,会受 max_allowed_packet 参数限制,导致操作失败。报错信息为:
Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (XXXX > YYYY). You can change this value on the server by setting the max_allowed_packet' variable
可使用下面的命令查看max_allowed_packet参数大小:
show VARIABLES like '%max_allowed_packet%';
解决方案,修改my.ini文件,在[mysqld]下新增或修改max_allowed_packet参数:
max_allowed_packet = 50M
修改后需重启mysql服务