After a table is locked in a individual session, other classes can not read or compose to the table unless the lock from the session is unveiled. For that reason, all other periods are in waiting manner until finally the lock is introduced.
This limited manual will demonstrate you how to display available locks using the show approach listing command.
How to Lock a Desk
To receive a lock state on a distinct table, you can use the LOCK TABLES statement. The general syntax for locking tables is:
In the lock sort, you can specify Browse or Go through lock. The example under sets the Produce lock on the actor desk.
When you have the lockset, all the other periods will not update any details saved in the desk.
For instance, the subsequent assertion will fall short until the table is unlocked.
MySQL will give you a browse error as:
How to Unlock a Desk
To unlock a desk, use the UNLOCK TABLES query as:
Exhibit Locked Tables
By default, there is no definitive way you can query to demonstrate for locked table like: (Clearly show LOCKED TABLES).
Nevertheless, we can use a processlist command to show the locked tables and the end users.
Use the command:
This will dump the info as properly as the queries waiting to lock.
The higher than example displays the root consumer locking the table in the actor table.
This shorter tutorial confirmed you how to lock and unlock tables and view the consumers who have a desk locked in a databases.