1.查看当前数据库进程

show processlist;  
show full processlist;

#前者只显示前100条,后者显示所有的进程

2.一键杀死某个用户的所有进程

select concat('KILL ',id,';') from information_schema.processlist where user='user'; 

3.查询是否锁表

show OPEN TABLES where In_use > 0;

4.查看正在锁的事务

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;

5.查看等待锁的事务

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS; 

6.查看当前有那些表是打开的。In_use列表示有多少线程正在使用某张表,Name_locked表示表名是否被锁

show open tables from database;

 

相关文章:

  • 2021-12-10
  • 2022-01-29
  • 2022-12-23
  • 2021-08-23
  • 2021-06-11
  • 2022-12-23
猜你喜欢
  • 2021-10-17
  • 2021-08-20
  • 2021-07-02
  • 2021-08-21
相关资源
相似解决方案