mysql事务和锁和进程查询命令

show open TABLEs

show status like ‘Table_locks%’ ;

查看锁

show status like ‘table%’;

show status like ‘innodb_row_lock%’;

show processlist

show variables like ‘%innodb_lock_wait_timeout%’;

show status like ‘%connect%’;

//查看当前连接数

show status like ‘Threads%’;

show status like ‘%lock%’

show status like ‘InnoDB_row_lock%’;

//事务

SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;

//查看 mysql 事务是否开启

SHOW VARIABLES LIKE ‘event_scheduler’;

//进程

SELECT * FROM information_schema.processlist;

//查看锁定的表

show OPEN TABLES where In_use > 0;

show engine innodb status;

//是否开启锁检测

show VARIABLES like ‘%detect%’

//查看事务级别

show variables like ‘transaction_isolation’;

show variables like ‘general_log’; --查看日志是否开启

set global general_log=ON; --开启日志

set global general_log=OFF; --关闭日志

// 查看最大连接数

show variables like ‘%max_connection%’;

开启general_log日记是比较消耗性能的,不需要的时候要关闭它

// 批量杀死事务
select concat(‘KILL ‘,id,’;’) from information_schema.processlist p inner
join information_schema.INNODB_TRX x on p.id=x.trx_mysql_thread_id where db=‘tuanjian’;

MySQL决定如何查找表中的行。依次从最优到最差分别为:system > const > eq_ref > ref > range > index > all。

KILL 710;
KILL 712;
KILL 714;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值