# net_write_timeout

> Seconds the server waits writing a block to a client before aborting.

Source: https://sqlly.app/sql-configuration/mysql/net-write-timeout
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).

**Default**

`60`

**Range**

1 to 31536000 seconds

**Restart needed**

No

**Default checked on**

MySQL 8.4 LTS

## What it does

When the server has a result block ready but the client has stopped reading, the write stalls and the connection is dropped after this limit. It is the usual server-side sign behind 'Lost connection to MySQL server during query' when a client abandons a huge result set mid-transfer.

## Default value

`60`. 60 seconds (MySQL 8.4).

## Check the current value

```
SHOW GLOBAL VARIABLES LIKE 'net_write_timeout';

SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME
FROM performance_schema.variables_info
WHERE VARIABLE_NAME = 'net_write_timeout';
```

## Change it

```
SET SESSION net_write_timeout = 300;   -- this connection
SET GLOBAL net_write_timeout = 300;    -- new connections, until restart
SET PERSIST net_write_timeout = 300;   -- new connections, and after restarts
```

No restart. SET GLOBAL (or SET PERSIST, which also survives restarts) applies to connections opened afterwards; existing connections keep their session value unless they SET it themselves.

## When to change it

For clients that legitimately pull large results slowly, such as report extracts over a WAN link; raise it in that session rather than globally.

## What can go wrong

A stalled client keeps its thread, its sort and read buffers, and any locks its open transaction holds until the timeout fires, so a large global value keeps dead sessions around longer. Fetch less per round trip, or stream the result, before stretching it server wide.

## The closest setting on other engines

| Engine | Setting | Default | Restart |
| --- | --- | --- | --- |
| MySQL | `net_write_timeout` this page | `60` | No |
| PostgreSQL | [`idle_session_timeout`](https://sqlly.app/sql-configuration/postgresql/idle-session-timeout) | `0 (disabled)` | No |
| SQL Server | [`remote query timeout (s)`](https://sqlly.app/sql-configuration/sql-server/remote-query-timeout) | `600` | No |
| Oracle | [`max_idle_time`](https://sqlly.app/sql-configuration/oracle/max-idle-time) | `0 (no limit)` | No |

## Questions about net_write_timeout

### What is the default value of net_write_timeout in MySQL?

60. 60 seconds (MySQL 8.4).

### Does changing net_write_timeout require a restart?

No. No restart. SET GLOBAL (or SET PERSIST, which also survives restarts) applies to connections opened afterwards; existing connections keep their session value unless they SET it themselves.

### When should I change net_write_timeout?

For clients that legitimately pull large results slowly, such as report extracts over a WAN link; raise it in that session rather than globally.

Back to all [MySQL settings](https://sqlly.app/sql-configuration/mysql), or check the [MySQL manual](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html) for every option.

## Related MySQL settings

- [`net_read_timeout` Seconds the server waits for more data from a client before aborting the read.](https://sqlly.app/sql-configuration/mysql/net-read-timeout)
- [`wait_timeout` Seconds a non-interactive connection may sit idle before the server closes it.](https://sqlly.app/sql-configuration/mysql/wait-timeout)
- [`max_allowed_packet` Largest single packet, and so the largest row, BLOB or statement, the server accepts.](https://sqlly.app/sql-configuration/mysql/max-allowed-packet)

## Related on SQLly

- [Diagnosing a slow SQL query Performance guide](https://sqlly.app/sql-performance/slow-query)
