How to fix ERROR 1154: Got read error from connection pipe in MySQL
ERROR 1154 occurs when the MySQL server fails to read data from the client connection pipe, typically due to network timeouts, oversized data transfers, or resource exhaustion. Fix it by increasing timeout settings, checking packet sizes, and ensuring proper connection handling.
Quick fix
Fixes 1154
SHOW GLOBAL STATUS LIKE 'Aborted_client';- Check the MySQL error log for context
- Verify the connection was aborted cleanly
- Increase net_read_timeout for slow networks
- Check and increase max_allowed_packet
SHOW GLOBAL STATUS LIKE 'Aborted_client';ERROR 1154: Got read error from connection pipe
What this error means
ERROR 1154 (SQLSTATE 08S01) is a network communication error that occurs when the MySQL server cannot read expected data from the client side of a TCP or named-pipe connection. The server aborts the statement, closes the session, and logs this error when the read operation fails. This error indicates the client has either disconnected abruptly or the connection is too unstable to reliably transfer data. Unlike ERROR 2013 (Lost connection during query), error 1154 happens during the initial data read phase, often before query execution completes.
Typical symptoms
- MySQL client connection drops unexpectedly during query execution
- Applications receive "read error from connection pipe" message
- Long-running queries fail intermittently with ERROR 1154
- Aborted_client counter increases in SHOW GLOBAL STATUS
- Data transfers fail when uploading large BLOB values or result sets
- Named pipe connections on Windows fail with broken pipe errors
Common causes
- Network timeout: The net_read_timeout (default 30 seconds) expires while waiting for client data, common in slow networks or with VPN instability
- Oversized packets: BLOB values or result sets exceed max_allowed_packet, causing partial reads and read failures
- Client abrupt disconnect: Application exits without calling mysql_close() or terminates the connection mid-transaction
- Operating system resource exhaustion: File descriptor limits, epoll slots, or socket buffers prevent MySQL from reading the socket
- Network latency or packet loss: High latency, intermittent connectivity, or packet loss causes data transmission delays
- Too many connections: Error 1040 (Too many connections) can trigger 1154 when clients wait in queue until pipe closes
- Long query interrupted: User navigates away or cancels a long-running query, breaking the pipe
- Windows named pipe buffer limits: Named pipe buffer is too small for the data being transferred
How to fix "ERROR 1154: Got read error from connection pipe"
Access your MySQL error log to see when 1154 errors occur. On Linux/Mac, check /var/log/mysql/error.log or /usr/local/var/mysql/error.log. On Windows, check MySQL Workbench or the MySQL data directory for error logs. Look for patterns: are errors clustered at specific times or only on certain queries?
Connect to MySQL and run:
SHOW GLOBAL STATUS LIKE 'Aborted_client';If Aborted_client is high and increasing, clients are disconnecting without proper cleanup. Check your application code to ensure mysql_close() or disconnect() is always called in a finally block or try-finally pattern.
The default net_read_timeout is 30 seconds. For slow networks or large data transfers, increase it:
SET GLOBAL net_read_timeout = 120;
SET SESSION net_read_timeout = 120;Set this proportional to your typical round-trip time plus query execution time (usually 60-120 seconds on slow/remote connections). To persist across restarts, add to /etc/mysql/my.cnf or /etc/my.cnf:
[mysqld]
net_read_timeout = 120
net_write_timeout = 120Large BLOB values or result sets may exceed the max_allowed_packet limit (default 16 MB). Check current value:
SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet';Increase it on server:
SET GLOBAL max_allowed_packet = 256M;And on client (e.g., mysql CLI):
mysql --max-allowed-packet=256M -u root -pPersist in my.cnf:
[mysqld]
max_allowed_packet = 256M
[mysql]
max-allowed-packet = 256MEnsure your application properly closes connections. In Node.js:
const connection = mysql.createConnection({ host, user, password });
try {
// execute query
finally {
connection.end(); // Always close
}In Python:
import mysql.connector
db = mysql.connector.connect(host="...", user="...", password="...")
try:
# execute query
finally:
db.close()For connection pooling (recommended for web apps), create a new connection per request rather than reusing stale connections:
const pool = mysql.createPool({ waitForConnections: true, ... });
pool.getConnection((err, conn) => {
try { /* query */ } finally { conn.release(); }
});When importing large datasets or BLOBs, break into smaller batches to avoid timeout and packet size issues:
-- Load 1 MB chunks at a time
LOAD DATA LOCAL INFILE '/path/to/largefile.csv'
INTO TABLE my_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n';Or in application code, insert in batches:
const batchSize = 1000;
for (let i = 0; i < rows.length; i += batchSize) {
const batch = rows.slice(i, i + batchSize);
await insertBatch(batch);
}Reduce network traffic for slow/remote connections. Using mysqldump with compression:
mysqldump --user=root --password --compress --all-databases > backup.sqlOr use an SSH tunnel to compress traffic:
ssh -L 3306:localhost:3306 user@remote-host
mysqldump --host=localhost --user=root --password > backup.sqlFor Windows named pipe connections, switch to TCP/IP or increase the named pipe buffer:
SET GLOBAL net_buffer_length = 65536;Use ping and traceroute to test connectivity to the MySQL server:
ping -c 10 mysql-server.example.com
traceroute mysql-server.example.comCheck MySQL connection status:
SHOW PROCESSLIST; -- See active connections
SHOW GLOBAL STATUS LIKE 'Threads%';
SHOW GLOBAL STATUS LIKE 'Aborted%';If latency is consistently high (>100ms), consider moving the client closer to the server or optimizing your network path.
Advanced notes
ERROR 1154 is related to ERROR 1158 (ER_NET_READ_ERROR), which signals a socket read failure (instead of named-pipe read failure). Fixes for 1154 mirror those for 1158. On Windows, named pipe connections require special handling: if you see 1154 on named pipes, switch to TCP/IP via 127.0.0.1 instead of localhost, or increase Windows pipe buffer sizes. For MariaDB servers, enable diagnostic logging by setting log_warnings to 4 or above to capture detailed error log messages about read failures. High Aborted_client counts also correlate with error 1040 (Too many connections): if you are hitting 1040, reduce max_connections or enable connection pooling with wait_timeout tuning to free stale connections faster.
Frequently asked questions
- What does "1154" mean?
- ERROR 1154 (SQLSTATE 08S01) is a network communication error that occurs when the MySQL server cannot read expected data from the client side of a TCP or named-pipe connection. The server aborts the statement, closes the session, and logs this error when the read operation fails. This error indicates the client has either disconnected abruptly or the connection is too unstable to reliably transfer data.
- How do I fix "1154"?
- ERROR 1154 occurs when the MySQL server fails to read data from the client connection pipe, typically due to network timeouts, oversized data transfers, or resource exhaustion. Fix it by increasing timeout settings, checking packet sizes, and ensuring proper connection handling.
- What causes "1154"?
- Network timeout: The net_read_timeout (default 30 seconds) expires while waiting for client data, common in slow networks or with VPN instability Oversized packets: BLOB values or result sets exceed max_allowed_packet, causing partial reads and read failures Client abrupt disconnect: Application exits without calling mysql_close() or terminates the connection mid-transaction
- Is the "1154" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐MySQL Official Documentation
- ๐MySQL 8.0 Error Reference - ER_NET_READ_ERROR_FROM_PIPE(Official Docs)
- ๐MySQL 8.0 Reference - Lost Connection Troubleshooting(Official Docs)
- ๐MySQL 8.0 Reference - Troubleshooting Problems Connecting(Official Docs)