// mysql · timeouts

innodb_lock_wait_timeout

Seconds an InnoDB transaction waits for a row lock before giving up.

По умолчанию
50
Range
1 to 1073741824 seconds
Restart needed
Нет
Default checked on
MySQL 8.4 LTS

Что оно делает

On timeout only the statement is rolled back (error 1205), not the transaction, unless innodb_rollback_on_timeout is ON. Deadlocks are detected separately and immediately.

Значение по умолчанию

50. 50 seconds (MySQL 8.4).

Check the current value

SHOW GLOBAL VARIABLES LIKE 'innodb_lock_wait_timeout';

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

Change it

SET SESSION innodb_lock_wait_timeout = 5;   -- this connection
SET GLOBAL innodb_lock_wait_timeout = 5;    -- new connections, until restart
SET PERSIST innodb_lock_wait_timeout = 5;   -- 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 for interactive OLTP so users get an error quickly instead of hanging; raise it per session for batch jobs that expect to wait.

What can go wrong

The application must handle error 1205; the transaction is still open after the failed statement.

The closest setting on other engines

ДвижокНастройкаПо умолчаниюRestart
MySQL innodb_lock_wait_timeout this page 50 Нет
PostgreSQL lock_timeout 0 (disabled) Нет
SQL Server LOCK_TIMEOUT -1 (wait forever) Нет
SQLite busy_timeout 0 Нет

Questions about innodb_lock_wait_timeout

What is the default value of innodb_lock_wait_timeout in MySQL?

50. 50 seconds (MySQL 8.4).

Does changing innodb_lock_wait_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 innodb_lock_wait_timeout?

Lower it for interactive OLTP so users get an error quickly instead of hanging; raise it per session for batch jobs that expect to wait.

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

// one client for every engine

Check innodb_lock_wait_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.