mysql Packet for query is too large 异常解决

<span style="font-size:12px;">org.springframework.dao.TransientDataAccessResourceException: 
### Error updating database.  Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (3141608 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.
### The error may involve com.joloplay.bms.mapper.newbss.GameVersionMapper.insertGameVersionBatch-Inline</span>

产生的主要原因就是,查询返回的数据量比较大,而允许返回的”max_allowed_packet”太小,导致以上错误。

[root@dev-db-test05 etc]# vi /etc/my.cnf
找到

max_allowed_packet = 1M
修改为 10M

保存,重启mysql

[root@dev-db-test05 init.d]# /etc/init.d/mysqld restart 

<pre name="code" class="html">Shutting down MySQL.... SUCCESS! 
Starting MySQL.. SUCCESS! 
[root@dev-db-test05 init.d]# 


 done! 
 


猜你喜欢

转载自blog.csdn.net/hwhanwan/article/details/51658939