mysql 查询、设置事务隔离级别 transaction_isolation

参考 https://jingyan.baidu.com/article/2f9b480d63f23c01ca6cc23d.html 

其他参考资料:

https://blog.csdn.net/java_w/article/details/103554447

https://www.cnblogs.com/hai-blog/p/8311687.html

https://blog.csdn.net/L_15156024189/article/details/87006324

https://blog.csdn.net/joe_007/article/details/7014381

方式1
show variables like 'transaction_isolation';
show variables like 'tx_isolation';
方式2
select @@global.tx_isolation,@@tx_isolation;
select @@global.transaction_isolation,@@transaction_isolation;

默认值为:REPEATABLE-READ
改为:READ-COMMITTED

1. 设置当前会话的事务级别为 READ-COMMITTED
-- 设置当前会话的事务级别为 READ-COMMITTED
set session transaction isolation level read committed;
-- 查看当前会话事务级别是否修改成功(全局会话未变:REPEATABLE-READ,当前会话已经更新为: READ-COMMITTED)
select @@global.tx_isolation,@@tx_isolation;
select @@global.transaction_isolation,@@transaction_isolation;

2. 设置全局事务级别为 READ-COMMITTED
-- 设置全局会话事务级别为 READ-COMMITTED
set global transaction isolation level read committed;
-- 查看当前会话事务级别是否修改成功(全局会话未变:REPEATABLE-READ,当前会话已经更新为: READ-COMMITTED)
select @@global.tx_isolation,@@tx_isolation;
select @@global.transaction_isolation,@@transaction_isolation;

你可能感兴趣的:(mysql)