Lock wait timeout exceeded; try restarting transaction 事务锁
程序员文章站
2022-03-09 19:35:32
...
该异常表明被执行资源独占锁被长时间拥有,导致当前sql获取事务锁超时。
表说明
information_schema
保存了MySQL服务器所有数据库的信息。如数据库名,数据库的表,表栏的数据类型与访问权限等。再简单点,这台MySQL服务器上,到底有哪些数据库、各个数据库有哪些表,每张表的字段类型是什么,各个数据库要什么权限才能访问,等等信息
innodb_trx
当前运行的所有事务
innodb_locks
当前出现的锁
innodb_lock_waits
锁等待的对应关系
sql
#获取所有正在执行的sql
show processlist;
#获取正在锁定资源的sql
#变量解释 RUNNING:正在运行的事务 LOCK WAIT:资源被锁定
select * from information_schema.innodb_trx WHERE trx_state like '%LOCK%';
# 获取被锁资源线程ID并和kill结合
select CONCAT('kill',' ',trx_mysql_thread_id,';') from information_schema.innodb_trx WHERE trx_state like '%LOCK%';
上一篇: 初次将项目推到github的命令
下一篇: Mac将代码上传到Github上
推荐阅读
-
Lock wait timeout exceeded; try restarting transaction
-
Mysql出现“ Lock wait timeout exceeded; try restarting trans
-
[Err] 1205 - Lock wait timeout exceeded; try restarting transaction
-
[Err] 1205 - Lock wait timeout exceeded; try restarting transaction
-
mysql 1205 - Lock wait timeout exceeded; try restarting transaction
-
MySQL 1205-Lock wait timeout exceeded; try restarting transaction
-
1205 - Lock wait timeout exceeded; try restarting transaction(解决备忘)
-
Lock wait timeout exceeded try restarting transaction
-
1205 - Lock wait timeout exceeded; try restarting transaction
-
Lock wait timeout exceeded; try restarting transaction