死锁详情查询
SELECT SUM(trx_rows_locked) AS rows_locked, SUM(trx_rows_modified) AS rows_modified, SUM(trx_lock_memory_bytes) AS lock_memory FROM information_schema.INNODB_TRX;
navicat实时查询
show OPEN TABLES where In_use > 0;SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;show processlist
mysql -uroot -p -e "show engine innodb status \G;" > /tmp/lock-`date +%F_%T`.txtcat /tmp/lock.txt|grep -i -n lockcat /tmp/lock.txt|grep -i -n "LATEST DETECTED DEADLOCK"在打印出来的信息中找到“LATEST DETECTED DEADLOCK”一节内容