-- 查看当前所有事务 select * from information_schema.innodb_trx; -- 查看正在锁的事务 select *
from information_schema.innodb_locks; -- 查看等待锁的事务 select * from
information_schema.innodb_lock_waits; -- 查看表锁 show open tables where In_use>0;
--查看死锁 show engine innodb status\G --查看元数据锁 SELECT * FROM
performance_schema.setup_instruments; UPDATE performance_schema.setup_consumers
SET ENABLED = 'YES' WHERE NAME ='global_instrumentation'; UPDATE
performance_schema.setup_instruments SET ENABLED = 'YES' WHERE NAME
='wait/lock/metadata/sql/mdl'; SELECT * FROM performance_schema.metadata_locks;