MySQL Error 2006 (HY000): MySQL server has gone away

Idle connection exceeded `wait_timeout` or query exceeded `max_allowed_packet`.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: MySQL Error 2006 (HY000) Platform: MySQL
Common Root Causes:
  • Idle connection exceeded `wait_timeout` or query exceeded `max_allowed_packet`.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Enable connection pool health checks (`pool_pre_ping`) and increase `max_allowed_packet` if needed.
Safe Diagnostic Command:
SHOW VARIABLES WHERE Variable_name IN ("wait_timeout", "max_allowed_packet");
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Idle connection exceeded `wait_timeout` or query exceeded `max_allowed_packet`. Recommended diagnostic: `SHOW VARIABLES WHERE Variable_name IN ("wait_timeout", "max_allowed_packet");`. Remediation: Enable connection pool health checks (`pool_pre_ping`) and increase `max_allowed_packet` if needed.

Worked Examples

  • Run `SHOW VARIABLES WHERE Variable_name IN ("wait_timeout", "max_allowed_packet");` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-mysql-2006-server-has-gone-away · Independently verified: 2026-11-25

Related Resources