MySQL error 1158: Error reading communication packets
The server got a read error on a client connection. Usually the client went away without closing it: a crash, a killed process or a network drop.
- Error number
1158- Name
ER_NET_READ_ERROR- SQLSTATE
08S01- Category
- Connection and client
What it means
1158 is mostly seen in the server's error log as an aborted connection, not by the client. It means the server tried to read from the connection and the read failed. Occasional ones are normal; many of them point at clients that don't close connections or network problems.
Common causes
- Application processes that exit or crash without closing their connections.
- Network equipment dropping connections.
- A packet larger than
max_allowed_packet.
How to fix it
-
Count aborted connections and see whether they keep rising.
SHOW GLOBAL STATUS LIKE 'Aborted_%';
-
Make applications close connections properly and pools recycle them; check the network between client and server if counts keep climbing.
Related errors
1159Got timeout reading communication packets2013Lost connection to MySQL server during query1153Got a packet bigger than max_allowed_packet
More connection and client errors
2002Can't connect through socket2003Can't connect to MySQL server on host2005Unknown MySQL server host2006MySQL server has gone away2055Lost connection to MySQL server at stage2026SSL connection error2059Authentication plugin cannot be loaded2061Authentication plugin reported error
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.