SQL Error 2013: Fix Lost Connection During Query
Fix SQL Error 2013 "Lost connection during query" on game servers. Learn timeout & packet size solutions for MySQL database operations in HeidiSQL.
2 min read
SQL Connection and Query Issues
This guide covers common SQL errors and their solutions for database operations on game servers.
SQL Error (2013) - Lost Connection During Query
This error occurs when the MySQL connection times out or the packet size exceeds configured limits during query execution.
Error Message:
SQL Error (2013): Lost connection to server during query
Notice: You can disable the "Stop on errors in batch mode" option to ignore such errors
Resolution Steps
- Open HeidiSQL and navigate to the query tab
- Execute the following configuration query to increase timeout and packet limits:
SET GLOBAL max_allowed_packet=1073741824;
SET GLOBAL wait_timeout = 3500;
SET GLOBAL net_read_timeout = 3500;
SET GLOBAL connect_timeout = 3500;
- Perform your database import or query operation
- After completing the operation, restore default settings:
SET GLOBAL max_allowed_packet=1073741824;
SET GLOBAL wait_timeout = 600;
SET GLOBAL net_read_timeout = 600;
SET GLOBAL connect_timeout = 600;
Configuration Parameters
| Parameter | Temporary Value | Default Value | Purpose |
|---|---|---|---|
| max_allowed_packet | 1073741824 | 1073741824 | Maximum packet size in bytes |
| wait_timeout | 3500 | 600 | Connection idle timeout in seconds |
| net_read_timeout | 3500 | 600 | Network read timeout in seconds |
| connect_timeout | 3500 | 600 | Initial connection timeout in seconds |
Related Articles
- SQLBackupAndFTP Backup Guide - Database backup configuration
- FiveM Error Troubleshooting - Connection and error solutions
- FiveM Performance Profiling - Server optimization tools
Need reliable database hosting for FiveM? View Vluxon FiveM VPS plans