MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction异常解决

系统无法登陆,查询日志发现执行update语句时有如下报错

### Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
; Lock wait timeout exceeded; try restarting transaction; nested exception is com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction

这条语句被锁住了

进入mysql使用

SELECT * FROM information_schema.innodb_trx where trx_state = 'LOCK WAIT'\G

查询被锁的语句,结果如下

MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction异常解决_第1张图片

这个线程的id是trx_mysql_thread_id: 25039

kill掉这个锁住的线程

kill 对应的trx_mysql_thread_id

恢复正常

 

 

 

你可能感兴趣的:(mysql)