How to fix ERROR 1154: Got read error from connection pipe in MySQL

MySQLINTERMEDIATEHIGHUpdated Dec 23, 2025ยท 198 views

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';
  1. Check the MySQL error log for context
  2. Verify the connection was aborted cleanly
  3. Increase net_read_timeout for slow networks
  4. Check and increase max_allowed_packet
mysql โ€” error
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

  1. Network timeout: The net_read_timeout (default 30 seconds) expires while waiting for client data, common in slow networks or with VPN instability
  2. Oversized packets: BLOB values or result sets exceed max_allowed_packet, causing partial reads and read failures
  3. Client abrupt disconnect: Application exits without calling mysql_close() or terminates the connection mid-transaction
  4. Operating system resource exhaustion: File descriptor limits, epoll slots, or socket buffers prevent MySQL from reading the socket
  5. Network latency or packet loss: High latency, intermittent connectivity, or packet loss causes data transmission delays
  6. Too many connections: Error 1040 (Too many connections) can trigger 1154 when clients wait in queue until pipe closes
  7. Long query interrupted: User navigates away or cancels a long-running query, breaking the pipe
  8. 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"

1Check the MySQL error log for context

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?

2Verify the connection was aborted cleanly

Connect to MySQL and run:

sql
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.

3Increase net_read_timeout for slow networks

The default net_read_timeout is 30 seconds. For slow networks or large data transfers, increase it:

sql
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:

ini
[mysqld]
net_read_timeout = 120
net_write_timeout = 120
4Check and increase max_allowed_packet

Large BLOB values or result sets may exceed the max_allowed_packet limit (default 16 MB). Check current value:

sql
SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet';

Increase it on server:

sql
SET GLOBAL max_allowed_packet = 256M;

And on client (e.g., mysql CLI):

bash
mysql --max-allowed-packet=256M -u root -p

Persist in my.cnf:

ini
[mysqld]
max_allowed_packet = 256M

[mysql]
max-allowed-packet = 256M
5Fix application connection handling

Ensure your application properly closes connections. In Node.js:

javascript
const connection = mysql.createConnection({ host, user, password });
try {
  // execute query
finally {
  connection.end(); // Always close
}

In Python:

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:

javascript
const pool = mysql.createPool({ waitForConnections: true, ... });
pool.getConnection((err, conn) => {
  try { /* query */ } finally { conn.release(); }
});
6For bulk data loads, chunk and batch transfers

When importing large datasets or BLOBs, break into smaller batches to avoid timeout and packet size issues:

sql
-- 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:

javascript
const batchSize = 1000;
for (let i = 0; i < rows.length; i += batchSize) {
  const batch = rows.slice(i, i + batchSize);
  await insertBatch(batch);
}
7For remote backups, use compression or tunneling

Reduce network traffic for slow/remote connections. Using mysqldump with compression:

bash
mysqldump --user=root --password --compress --all-databases > backup.sql

Or use an SSH tunnel to compress traffic:

bash
ssh -L 3306:localhost:3306 user@remote-host
mysqldump --host=localhost --user=root --password > backup.sql

For Windows named pipe connections, switch to TCP/IP or increase the named pipe buffer:

sql
SET GLOBAL net_buffer_length = 65536;
8Monitor network health and connection metrics

Use ping and traceroute to test connectivity to the MySQL server:

bash
ping -c 10 mysql-server.example.com
traceroute mysql-server.example.com

Check MySQL connection status:

sql
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