-- 全局事务等级
select @@global.tx_isolation;
-- 会话事务等级
select @@session.tx_isolation;
-- 当前事务等级
select @@tx_isolation;
-- 查询是否锁表
show open table where in_use >0
-- 查看所有进程 mysql
show processList;
-- mariadb
show full PROCESSLIST;
-- 查找到对应的 pid 后
-- 可以使用 kill pid
-- 查看正在锁的事务
select * from information_schema.INNODB_LOCKS;
-- 查看等待锁的事务
select * from information_schema.INNODB_LOCK_WAITS;
-- 查看innodb引擎的运行信息
show ENGINE innodb status \G;
-- 查看造成死锁的sql语句,分析索引情况,然后优化sql语句;
-- 查看服务器的状态
show status like '%lock%';
-- 查看超时时间
show variables like '%timeout%';