解决错误:Lock wait timeout exceeded; try restarting transaction

报错信息

org.springframework.dao.CannotAcquireLockException: Hibernate operation: could not execute update query; SQL [xxxxxxxx]; Lock wait timeout exceeded; try restarting transaction; nested exception is java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

报错原因

MySQL的事务产生了死锁 。

解决方案

1、查询线程id

select trx_mysql_thread_id from information_schema.innodb_trx;

得到的就是线程的id

2、kill 线程的id

kill trx_mysql_thread_id;

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/baidu_29679655/article/details/117984469
今日推荐