MySQL Packet for query is too large解决方法
-
- 背景:昨天上线的分配订单业务在读取订单到缓存中时,由于是批量从DB查询读取缓存,一次查询读取数据量较大( Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4935 > 2048). You can change this value on the server by setting the max_allowed_packet' variable. ; Packet for query is too large (4935 > 2048). You can change this value on the),但是测试环境(阿里云)就没有,生产环境(华为云)出现了上面问题,可能是当时安装mysql配置不同的原因
- 检查过程
- 解决办法
背景:昨天上线的分配订单业务在读取订单到缓存中时,由于是批量从DB查询读取缓存,一次查询读取数据量较大( Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4935 > 2048). You can change this value on the server by setting the max_allowed_packet’ variable. ; Packet for query is too large (4935 > 2048). You can change this value on the),但是测试环境(阿里云)就没有,生产环境(华为云)出现了上面问题,可能是当时安装mysql配置不同的原因
检查过程
show VARIABLES like ‘%max_allowed_packet%’;