解决mysql锁表问题com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceede

报错如下:
解决mysql锁表问题com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceede
在navicat中执行如下语句:

1、查询是否锁表
show open tables where in_use>0;
 
2、查询进程
show processlist
查询到相对应的进程,然后 kill id
 
3、查看正在锁的事务
select * from information_schema.innodb_locks; 
 
4、查看等待锁的事务
select * from information_schema.innodb_lock_waits;

解决mysql锁表问题com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceede
解决mysql锁表问题com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceede
找到锁表的进程:
解决mysql锁表问题com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceede
找到相应的db的id,然后杀死进程
kill id
例如:kill 72
解决mysql锁表问题com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceede

上一篇:05、linux常用命令2


下一篇:【Linux】如何杀掉defunct进程-僵尸进程