2006: MySQL server has gone away
MySQL의미
명령 실행 중 클라이언트와 서버 간 연결이 끊어졌다. 서버가 연결을 닫았거나 패킷을 거부했을 수 있다.
원인
wait_timeout/interactive_timeout 만료로 닫힌 idle 연결, max_allowed_packet보다 큰 쿼리/데이터, 서버 재시작 또는 크래시, 또는 네트워크 단절.
해결 방법
idle 연결 문제는 커넥션 풀의 validation을 사용하고 wait_timeout을 검토한다. 큰 데이터를 보낸다면 max_allowed_packet을 늘린다(예: SET GLOBAL max_allowed_packet = 64*1024*1024, 영구 적용은 my.cnf). 서버 로그에서 재시작/크래시와 OOM 흔적을 확인한다. 끊어진 연결에 대비해 애플리케이션에 재접속 로직을 추가한다.
같은 데이터베이스의 다른 항목
- 1054Unknown column in field list
- 2002Can't connect to local MySQL server through socket
- 2003Can't connect to MySQL server (TCP/IP)
- 1114The table is full
- 1215Cannot add foreign key constraint
- 1451Cannot delete or update a parent row: a foreign key constraint fails
- 1452Cannot add or update a child row: a foreign key constraint fails