mysql process lock

处理死锁

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数据库中执行:

  1. desc innodb_locks

innodb_locks;

  1. desc innodb_lock_waits;

innodb_lock_waits;

  1. desc innodb_trx;

innodb_trx;

select * from innodb_trx;
select * from innodb_lock_waits;
select * from innodb_locks;

命令文档

参考文档