// mysql · timeouts

interactive_timeout

Idle timeout for interactive clients such as the mysql command-line client.

Standard
28800 (8 hours)
Range
1 to 31536000 seconds
Restart needed
Nein
Default checked on
MySQL 8.4 LTS

Was es bewirkt

When a client connects with CLIENT_INTERACTIVE, its session wait_timeout is initialized from this value.

Standardwert

28800 (8 hours). 28800 seconds (MySQL 8.4).

Check the current value

SHOW GLOBAL VARIABLES LIKE 'interactive_timeout';

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

Change it

SET SESSION interactive_timeout = 3600;   -- this connection
SET GLOBAL interactive_timeout = 3600;    -- new connections, until restart
SET PERSIST interactive_timeout = 3600;   -- 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

Lower it if forgotten shell sessions hold locks or connections.

What can go wrong

Low.

Questions about interactive_timeout

What is the default value of interactive_timeout in MySQL?

28800 (8 hours). 28800 seconds (MySQL 8.4).

Does changing interactive_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 interactive_timeout?

Lower it if forgotten shell sessions hold locks or connections.

Back to all MySQL settings, or check the MySQL manual for every option.

// one client for every engine

Check interactive_timeout on your own server

SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.