# 查询死锁的线程或事务, 拼接成kill脚本
select concat('KILL ',id,';') from information_schema.processlist where user='root';
# 运行上方查询的结果
KILL 59479;
KILL 59447;
select * from information_schema.innodb_trx;
-- 获取一下锁阻塞信息
SELECT r.trx_id waiting_trx_id, r.trx_mysql_thread_id waiting_thread, r.trx_query waiting_query, b.trx_id blocking_trx_id, b.trx_mysql_thread_id blocking_thread, b.trx_query blocking_query
FROM information_schema.innodb_lock_waits w
INNER JOIN information_schema.innodb_trx b ON b.trx_id = w.blocking_trx_id
INNER JOIN information_schema.innodb_trx r ON r.trx_id = w.requesting_trx_id