MySQL数据库死锁排查
【MySQL数据库死锁排查】第一种:
1.查询是否锁表
show open tables where in_use > 0;
2.查询进程(如果您有super权限,您可以看到所有线程。否则,您只能看到您自己的线程)
show processlist
3.杀死进程id(就是上面命令的id列)
kill id
第二种:
1.查看下在锁的事务
select * from information_schema.innodb_trx;
2.杀死进程id(就是上面命令的trx_mysql_thread_id列)
kill 线程id
例子:
查出死锁进程:show processlist
杀掉进程 kill 420821;
其它关于查看死锁的命令:
1:查看当前的事务
select * from information_schema.innodb_trx;
2:查看当前锁定的事务
select * from information_schema.innodb_locks;
3:查看当前等锁的事务
select * from information_schema.innodb_lock_waits;
第三种:
show engine innodb status
推荐阅读
- Docker应用:容器间通信与Mariadb数据库主从复制
- 数据库设计与优化
- 数据库总结语句
- py连接mysql
- 2019-01-18Mysql中主机名的问题
- MySql数据库备份与恢复
- mysql|InnoDB数据页结构
- 数据库|SQL行转列方式优化查询性能实践
- mysql中视图事务索引与权限管理
- MYSQL主从同步的实现