mysql批量插入大量数据时报Packet for query is too large (138666736 > 67108864)
Packet for query is too large (138,666,736 > 67,108,864). 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 (138,666,736 > 67,108,864). You can change this value on the server by setting the 'max_allowed_packet' variable.
-- 查看max_allowed_packet的大小
show VARIABLES like 'max_allowed_packet'
而实际数据大于这个值,而报错,
-- 修改为200M,只是临时修改,重启后会变成原来的值
set GLOBAL max_allowed_packet=200*1024*1024
重新连接后查看会变成200M.
mysql 8
2023-12-27
本文暂时没有评论,来添加一个吧(●'◡'●)