Packet for query is too large (30,647,972 > 20,971,520). You can change this val excel max_allowed_packet
程序员文章站
2022-03-01 20:21:21
...
做excel 数据批量导入功能2万条数据 报错
com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (30,647,972 > 20,971,520). You can change this value on the server by setting the 'max_allowed_packet' variable.
; Packet for query is too large (30,647,972 > 20,971,520). You can change this value on the server by setting the 'max_allowed_packet' variable.; nested exception is com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (30,647,972 > 20,971,520). You can change this value on the server by setting the 'max_allowed_packet' variable.] with root cause
解决方案
show VARIABLES like '%max_allowed_packet%';
set global max_allowed_packet = 3*1024*1024*10
设置后 需要断开连接后再查询即可