处理死锁
SHOW PROCESSLIST; //显示哪些线程正在运行 SELECT CONNECTION_ID(); SHOW ENGINE INNODB STATUS; //显示innoDB存储引擎的状态 SELECT * FROM information_schema.INNODB_TRX //查看有是哪些事务占据了表资源 innodb_lock_wait 锁 等待
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
去information_schema数据库中执行:
- desc innodb_locks
;
- desc innodb_lock_waits;
;
- desc innodb_trx;
;
select * from innodb_trx; select * from innodb_lock_waits; select * from innodb_locks;