查看数据库事务隔离级别
mysql> show variables like 'transaction%'; mysql> select @@transaction_isolation;
修改事务隔离级别的方式
1.只在本次会话有效
mysql> set session transaction isolation level read committed;
2.设置全局的事务隔离级别,该设置不会影响当前已经连接的会话,新会话,将使用新设置的事务隔离级别
mysql> set global transaction isolation level read committed;
3.修改配置文件,重启后生效
[mysqld] transaction-isolation = REPEATABLE-READ transaction-read-only = OFF
Transication A | Transication B |
---|---|
begin; | begin; |
![]() |
- |
- | ![]() |
![]() |
- |
- | commit; |
![]() |
- |