mysql 常用sql脚本
2021-03-05 21:41 Tony、 阅读(310) 评论(0) 编辑 收藏 举报# 查看事物隔离级别
select @@tx_isolation;
# 设置全局隔离级别 set global transaction isolation level REPEATABLE READ; set global transaction isolation level READ COMMITTED; set global transaction isolation level READ UNCOMMITTED; set global transaction isolation level SERIALIZABLE; #设置会话隔离级别 set session transaction isolation level REPEATABLE READ; set session transaction isolation level READ COMMITTED; set session transaction isolation level READ UNCOMMITTED; set session transaction isolation level SERIALIZABLE;
#开启事物
start transaction
select * from a where id=1 lock in share mode
commit;
rollback;
#自动提交
show variables like 'AUTOCOMMIT';
set autocommit = 0;
#设置锁
select * from a where id=1 lock in share mode
select * from a where id=1 for update
#查看正在执行的事物
SELECT * FROM information_schema.INNODB_TRX