赞
踩
1、查看当前正在使用的表
show open tables where in_use (in_use代表次数、Name_locked 代表对表重命名时发送死锁)
2、show full processlist

time 代表执行的秒数,info 阻塞的sql语句
或者 可以进一步筛洗哪些db

3、当前运行的所有事务
SELECT * FROM information_schema.INNODB_TRX; |

4、当前出现的锁
SELECT * FROM information_schema.INNODB_LOCKs;
5、锁等待的对应关系

6、 kill
- SELECT p.id, p.time, x.trx_id, x.trx_state, p.info FROM INFORMATION_SCHEMA.PROCESSLIST p, INFORMATION_SCHEMA.INNODB_TRX x WHERE
- p.id = x.trx_mysql_thread_id ;
kill掉688mysql会重新生成一个id,得kill两次
直接kill掉687 会当前beginx中断事务,被阻塞的事务将会被提交

7、分析死锁日志
show engine innodb status

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。