MySQL LOCK TABLE

suggest change

Syntax

Remarks

Locking solves concurrency problems. A transaction that reads a value and later writes it needs a consistent lock. A single INSERT, UPDATE, or DELETE still takes locks, but you do not have to take them yourself.

There are two kinds of locks available

READ LOCK - when a user is only reading from a table.

WRITE LOCK - when a user is doing both reading and writing to a table.

When a user holds a WRITE LOCK on a table, no other users can read or write to that table. When a user holds a READ LOCK on a table, other users can also read or hold a READ LOCK, but no user can write or hold a WRITE LOCK on that table.

If default storage engine is InnoDB, MySQL automatically uses row level locking so that multiple transactions can use same table simultaneously for read and write, without making each other wait.

For all storage engines other than InnoDB, MySQL uses table locking.

For more details about table lock See here

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents