Home > Database > Mysql Tutorial > body text

How to solve the table lock problem when mysql deletes the table

王林
Release: 2020-10-19 10:57:38
Original
4903 people have browsed it

Method to solve the problem of table locking when MySQL deletes a table: First check whether there are transactions being executed. If there are uncommitted transactions, kill the transaction or wait for the transaction to be submitted; then re-execute the table deletion operation.

How to solve the table lock problem when mysql deletes the table

Problem description:

(Recommended tutorial: mysql video tutorial)

1. drop table, causing the table to be locked, and it keeps waiting.

2. SHOW FULL PROCESSLIST; can find the waiting process.

3. After killing the corresponding lock, the query will not be affected.

4. Delete the table again and a locked table appears.

Problem Solution:

Use the following statement to query whether there are transactions being executed. If there are uncommitted transactions, you can consider killing the transaction or waiting for the transaction to be submitted.

SELECT trx_state, trx_started, trx_mysql_thread_id, trx_query FROM information_schema.innodb_trx;
Copy after login

Query a transaction that is being executed, and delete the table after killing it. The operation is normal.

Related recommendations: mysql tutorial

The above is the detailed content of How to solve the table lock problem when mysql deletes the table. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!