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