MySQL unlocks the state of being deadlocked

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/hotdust/article/details/51524469

From

Http://www.2cto.com/database/201303/193062.html

Http://www.itnose.NET/detail/6399027.html

There are two ways to unlock the state of a deadlock:

The first type:

1. Check if the table is locked

Show OPEN TABLES where In_use > 0;

2. Query the process (if you have super privileges, you can see all the threads.) Otherwise, you can only see your own threads)

Show Processlist

3. Kill the Process ID (which is the ID column of the above command)

Kill ID

The second type:

1. View the transactions under the lock

SELECT * from INFORMATION_SCHEMA. Innodb_trx;

2. Kill the Process ID (the trx_mysql_thread_id column of the above command)

Kill thread ID

Other commands for viewing deadlocks:

1: View the current transaction
SELECT * from INFORMATION_SCHEMA. Innodb_trx;

2: View the currently locked transactions

SELECT * from INFORMATION_SCHEMA. Innodb_locks;

3: View transactions for the current lock
SELECT * from INFORMATION_SCHEMA. Innodb_lock_waits;

http://blog.csdn.net/qq105319914/article/details/50562783

MySQL unlocks the state of being deadlocked

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.