MySQL error 1160 (ER_NET_ERROR_ON_WRITE) signals that the server failed to write data to the client because the network connection broke or stalled.
MySQL Error 1160: ER_NET_ERROR_ON_WRITE appears when the server cannot write a result set to the client due to a dropped or stalled network socket. Check firewalls, timeouts, and packet sizes, then increase net_write_timeout − most cases resolve by stabilizing the network path.
Got an error writing communication packets
Error 1160 returns the message "Got an error writing communication packets". MySQL raises it when the server tries to send data to the client but the underlying TCP socket fails.
The failure usually involves network drops, firewall timeouts, overloaded buffers, or very large result sets that exceed timeout limits.
Because the write never finishes, the connection ends in SQLSTATE 08S01, marking it as a communications link failure.
Unstable networks interrupt packet delivery, leaving the server unable to flush its output buffer. A mid-query disconnect instantly produces ER_NET_ERROR_ON_WRITE.
Firewalls or load balancers that cut idle or long-running connections drop the socket during result streaming.
MySQL detects the loss only when it writes, not when it reads.
Small timeout settings like net_write_timeout
or interactive_timeout
close sessions before large result sets finish transmitting, triggering the error.
Excessively large BLOB or TEXT fields can overflow packet buffers, especially when max_allowed_packet
is too small.
First confirm the network path between client and server is reliable.
A simple ping
or traceroute
reveals packet loss or high latency that causes socket resets.
Increase net_write_timeout
on the server to give long result sets more time to flush. On the client, raise read_timeout
to match.
Check firewall and proxy rules for idle-connection limits.
Whitelist the client subnet or extend the keep-alive interval so the proxy does not kill MySQL sockets.
Reduce result size: add indexes, LIMIT clauses, or paginate queries to avoid streaming millions of rows in one go.
VPN users often see 1160 when the tunnel briefly drops. Reconnect or switch to a wired link fixes the issue.
Batch ETL jobs pulling huge tables time out on corporate firewalls.
Setting net_buffer_length = 1M
and net_write_timeout = 120
plus chunked extraction resolves the failure.
Keep net_write_timeout
at least 60 seconds in production. Configure TCP keep-alive at the OS layer so intermediate devices know the connection is active.
Paginate large exports instead of selecting the entire table. Galaxy’s AI copilot can automatically insert LIMIT and OFFSET clauses to streamline big data transfers.
Monitor network latency with tools like mysqladmin ping
and track retransmits.
Alert when latency spikes beyond your timeout thresholds.
MySQL Error 1159 ER_NET_PACKET_TOO_LARGE: Happens when a single packet exceeds max_allowed_packet
. Increase the variable or split BLOBs.
MySQL Error 2013 Lost connection to MySQL server during query: Similar network interruption but detected while reading. Verify net_read_timeout
.
.
No. It only allows longer writes before timing out. Normal queries finish faster and are unaffected.
Ignoring it risks data loss because the client may believe the query succeeded. Always investigate and fix the root cause.
Indirectly. If a row exceeds the packet limit the socket can close, leading to a write error. Raising the limit prevents this.
Galaxy spots large unfiltered SELECTs and suggests LIMIT clauses, and its AI copilot can chunk exports automatically, reducing the likelihood of timeouts.