When issuing a query on MySQL I get a Lost Connection error
Validated on 4 Oct 2022 • Last edited on 8 Jul 2024
ERROR 2013 (HY000) at line xx: Lost connection to MySQL server during query
A Lost Connection
error occurs when:
- You have network connectivity issues.
- Your query is taking too long to complete.
If you are consistently getting this error and queries are taking longer than 30 seconds (the default value for MySQL’s net_read_timeout
variable) to complete:
- Check for network connectivity issues.
- Revise your query to not send as much data, and therefore be faster.
- Split your query into multiple smaller queries.