Database/MYSQL
Packet for query is too large (4,333,196 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.
imsseong
2022. 11. 1. 11:59
에러:
Packet for query is too large (4,333,196 > 4,194,304). 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 (4,333,196 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.
원인:
max_allowed_packet 값은 서버에 전달 또는 서버로부터 받게 되는 패킷의 최대 길이를 나타내는 시스템 변수이다.
현재 max_allowed_packet은 4,194,304Byte로 4MB로 설정되어 있다.
쿼리 길이가 packet에 설정한 최대 길이 제한보다 큰 경우 발생
해결:
max_allowed_packet 설정값 보기
SHOW VARIABLES LIKE 'max%';
max_allowed_packet 값을 8MB로 변경
SET GLOBAL max_allowed_packet = 8388608;
SET SESSION max_allowed_packet = 8388608;