MySql Packet for query is too large问题解决方案

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服务

posted @ 2019-08-14 01:32  oliverreal  阅读(1863)  评论(0编辑  收藏  举报