DataBase/MySQL
MySQL - Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (3004 > 2048). You can change this value on the server by setting the max_allowed_packet' variable.; 해결
H.Sunny,,
2021. 10. 8. 10:57
MySQL과 연동하여 개발 시 다음과 같은 에러가 발생하는 경우가 있다.
Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (3004 > 2048).
You can change this value on the server by setting the max_allowed_packet' variable.;
nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--> MySQL로 들어오는 패킷이 MySQL에 설정되어 있는 값 보다 큰 경우 발생
다음 2가지 방법 중 한가지로 해결 할 수 있다.
1. MySQL 설정 파일에 "max_allowed_packet=32M" 와 같이 패킷의 크기를 강제로 설정
리눅스 계열 - my.cnf
윈도우 - my.ini
-- > 재시작 필요
2. SET GLOBAL max_allowed_packet = 1048576; 실행
-- > 재시작 필요 없음, 그러나 추후 재시작 하면 해당 설정은 유효하지 않음
당장 급한 경우라면 2번을 먼저 해놓고 1번도 같이 작업을 해놓자. 언젠가는 MySQL도 재시작을
할 이슈가 있을테니...