Home  >  Article  >  Database  >  How to unlock mysql lock table

How to unlock mysql lock table

anonymity
anonymityOriginal
2019-05-06 11:57:0320150browse

How to unlock mysql lock table

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

How to unlock mysql lock table

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn