mysql 常用命令

时间:2024-03-12 16:59:54

1、显示锁的时间

show status like 'innodb_row_lock%';

2、锁一行的方法

//开启
begin;
//锁一行
select * from tbl_user where name = '1aa1' for update;

//解锁
commit;

在这里插入图片描述
3、设置不自动提交

set autocommit = 0;
//自动提交
set autocommit = 1;

4、查看是否支持profile

show variables like 'profiling';
//开启profile
set profiling = on;
//关闭profile
set profiling = off;
//查看profiling
show profiles;
show profile cup,block io for query 1;