0%

MySQL事务隔离

MySQL 事务隔离相关命令如下:

1
2
3
4
5
6
7
8
9
10
11
-- 查看当前会话隔离级别
SELECT @@tx_isolation;

-- 查看系统隔离级别
SELECT @@global.tx_isolation;

-- 0. SERIALIZABLE
-- 1. REPEATABLE READ
-- 2. READ COMMITTED
-- 3. READ UNCOMMITTED
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

MySQL 默认的隔离级别是 RR, Repeatable Read。