MySQL: Lost connection to MySQL server during query
Overview
The error Lost connection to MySQL server during query occurs when the connection between Skyvia and the MySQL server is dropped while a command is being executed. This typically happens when processing large datasets or when server-side timeout limits are too low.
Root Causes
- The operation takes longer than the Command Timeout or Connection Timeout configured in Skyvia.
- The MySQL server drops the connection due to
net_read_timeout or net_write_timeout limits being exceeded. - The data packet size exceeds the
max_allowed_packet limit on the MySQL server.
Resolution
Step 1: Increase timeout values in Skyvia
- Go to Skyvia → Connections.
- Find and open your MySQL connection.
- Click Edit.
- Open Advanced Settings.
Increase or set to 0 (no limit) the following parameters:
- Command Timeout - maximum time in seconds for a single command to execute.
- Connection Timeout - maximum time in seconds to establish a connection.
- Click Save and retry the integration.
Step 2: Adjust MySQL server parameters
If the issue persists, increase the following system variables on your MySQL server:
| Parameter | Description |
|---|
max_allowed_packet | Maximum size of a single data packet. Increase if transferring large rows or BLOBs. |
net_read_timeout | Seconds the server waits for data from the client before aborting the read. |
net_write_timeout | Seconds the server waits to write a block to the client before aborting. |
These can be set in your my.cnf / my.ini configuration file or applied dynamically:
SET GLOBAL max_allowed_packet = 67108864;
SET GLOBAL net_read_timeout = 3600;
SET GLOBAL net_write_timeout = 3600;
Useful Links
Related Articles
SQL Server: Execution Timeout Expired
Overview The error Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding occurs when a SQL Server command takes longer to execute than the configured timeout limit allows. This is ...
Query execution timeout exceeded error
Overview This error occurs when a query takes too long to execute, typically because it processes a large dataset or uses inefficient filters. Resolution Apply WHERE filters to reduce the amount of data being queried. Review and optimize JOINs and ...
Replication: MySQL Error: Row size too large (> 8126)
Overview When performing replication to MySQL you can encounter this error: An error occurred while creating table 'Invoice'. Error: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 ...
Skyvia Query: Verify Data in Your Connection
Overview Skyvia Query allows you to browse and verify data in any connected data source directly from the Skyvia interface, without writing complex scripts or using third-party tools. You can use the visual Builder view or write custom SQL ...
Skyvia IPs for Whitelist
Overview Skyvia is a cloud-based platform that connects to your data sources and targets over the internet. If your database, server, or cloud service restricts inbound connections by IP address (e.g., via firewall rules, security groups, or ...