@[TOC](记录一次MySql锁等待 (Lock wait timeout exceeded)异常)
Java执行一个SQL查询未提交,遇到1205错误。
java.lang.Exception:
### Error updating database. Cause: java.sql.SQLException: Lock wait timeout exceeded; try restarting transactionClusterManager: Error managing cluster: Failure recovering jobs: Lock wait timeout exceeded; try restarting transaction
解决办法:
执行mysql命令:
SELECT * FROM information_schema.innodb_trx;
然后找出trx_state值为“LOCK WAIT”的记录,根据记录中查询语句的系统id(trx_mysql_thread_id):kill掉被锁住的线程id
KILL trx_mysql_thread_id ;