Update backup user permissions, remove the –single-transaction flag, or downgrade mysqldump.
How do I fix the "Lost Connection" error when issuing a query on MySQL?
Validated on 20 Nov 2024 • Last edited on 18 Mar 2026
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.
Related Topics
How do I fix the mysqldump "Couldn't execute FLUSH TABLES Access denied" error?
Why does MySQL shut down when importing data with the source command?
Use MySQL’s import command instead of source for handling large data imports.
How do I fix the "1227" error?
Remove or replace the DEFINER in the dump file.