ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

information_schema库中有三个关于锁的表:

  • innodb_trx ## 当前运行的所有事务
  • innodb_locks ## 当前出现的锁
  • innodb_lock_waits ## 锁等待的对应关系

解决办法

select * from information_schema.innodb_trx;
select * from information_schema.innodb_locks;
select * from information_schema.innodb_lock_waits;
-- 找到一直没有提交的事务
kill <trx_mysql_thread_id>

标签: mysql

添加新评论