mysql5.5:
mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.00 sec)mysql> set transaction isolation level read uncommitted;
Query OK, 0 rows affected (0.00 sec)mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.00 sec)明明修改为 read uncommitted 了,为什么还是 repeatable read 呢?
mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.00 sec)mysql> set transaction isolation level read uncommitted;
Query OK, 0 rows affected (0.00 sec)mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.00 sec)明明修改为 read uncommitted 了,为什么还是 repeatable read 呢?
Query OK, 0 rows affected (0.00 sec)mysql> show variables like '%tx%';
+---------------+------------------+
| Variable_name | Value |
+---------------+------------------+
| tx_isolation | READ-UNCOMMITTED |
+---------------+------------------+
1 row in set (0.00 sec)mysql> set tx_isolation=1;
Query OK, 0 rows affected (0.00 sec)mysql> show variables like '%tx%';
+---------------+----------------+
| Variable_name | Value |
+---------------+----------------+
| tx_isolation | READ-COMMITTED |
+---------------+----------------+
1 row in set (0.00 sec)mysql> set tx_isolation=2;
Query OK, 0 rows affected (0.00 sec)mysql> show variables like '%tx%';
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| tx_isolation | REPEATABLE-READ |
+---------------+-----------------+
1 row in set (0.00 sec)mysql> set tx_isolation=3;
Query OK, 0 rows affected (0.00 sec)mysql> show variables like '%tx%';
+---------------+--------------+
| Variable_name | Value |
+---------------+--------------+
| tx_isolation | SERIALIZABLE |
+---------------+--------------+
1 row in set (0.00 sec)mysql> select @@tx_isolation;
+----------------+
| @@tx_isolation |
+----------------+
| SERIALIZABLE |
+----------------+
1 row in set (0.00 sec)mysql> show global variables like '%tx%';
+---------------+----------------+
| Variable_name | Value |
+---------------+----------------+
| tx_isolation | READ-COMMITTED |
+---------------+----------------+
1 row in set (0.00 sec)
Variable Name
tx_isolation
Variable Scope
Global, Session
Dynamic Variable
Yes
Permitted Values Type
enumeration
Default
REPEATABLE-READ
Valid Values
READ-UNCOMMITTED
READ-COMMITTED
REPEATABLE-READ
SERIALIZABLE
The default transaction isolation level. Defaults to REPEATABLE-READ. This variable can be set directly, or indirectly using the SET TRANSACTION statement. See Section 13.3.6, “SET TRANSACTION Syntax”. If you set tx_isolation directly to an isolation level name that contains a space, the name should be enclosed within quotation s, with the space replaced by a dash. For example:
SET tx_isolation = 'READ-COMMITTED';
Any unique prefix of a valid value may be used to set the value of this variable. The default transaction isolation level can also be set at startup using the --transaction-isolation server option.
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation