What is a MySQL lock table?
In order to better optimize mysql under high concurrency conditions, it is necessary to understand the table locking mechanism when mysql queries are updated.
MySQL has three lock levels: page level, table level, and row level.
MyISAM and MEMORY storage engines use table-level locking; the BDB storage engine uses page-level locking (page-level
locking), but also supports table-level locking. Lock; InnoDB storage engine supports both row-level locking (row-level locking) and table-level locking, but row-level locking is used by default.
The characteristics of these three locks in MySQL can be roughly summarized as follows:
Table-level locks: low overhead, fast locking; no deadlocks; large locking granularity, high probability of lock conflicts The highest and the lowest concurrency.
Row-level lock: high overhead, slow locking; deadlock will occur; the locking granularity is the smallest, the probability of lock conflict is the lowest, and the concurrency is the highest.
Page lock: The cost and locking time are between table locks and row locks; deadlocks will occur; the locking granularity is between table locks and row locks, and the concurrency is average.
How to solve the lock table? How to unlock MySQL lock table?
1. Check the process, mainly to find the ID of the process whose table is locked
SHOW PROCESSLIST;
2. Kill the one who unlocked the table Process ID
KILL 10866;//The following number is the ID of the process
The above is the detailed content of How to unlock mysql lock table. For more information, please follow other related articles on the PHP Chinese website!