ZhangZhihui's Blog  
  • REPEATABLE READ (default)

  • READ COMMITTED

  • READ UNCOMMITTED

  • SERIALIZABLE

 

zzh@ZZHPC:~$ docker run --name mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=aaa -e MYSQL_DATABASE=simple_bank -d mysql
ac3cce2a639d2379500723acbd9149aa4f92d1d76c8c7b0c3abcc0b382b311af
zzh@ZZHPC:~$ docker exec -it mysql8 mysql -uroot -paaa simple_bank

mysql> select @@transaction_isolation;
+-------------------------+
| @@transaction_isolation |
+-------------------------+
| REPEATABLE-READ         |
+-------------------------+
1 row in set (0.00 sec)

mysql> select @@global.transaction_isolation;
+--------------------------------+
| @@global.transaction_isolation |
+--------------------------------+
| REPEATABLE-READ                |
+--------------------------------+
1 row in set (0.00 sec)

mysql> set session transaction isolation level serializable;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@transaction_isolation;
+-------------------------+
| @@transaction_isolation |
+-------------------------+
| SERIALIZABLE            |
+-------------------------+
1 row in set (0.00 sec)

mysql> select @@global.transaction_isolation;
+--------------------------------+
| @@global.transaction_isolation |
+--------------------------------+
| REPEATABLE-READ                |
+--------------------------------+
1 row in set (0.00 sec)

mysql> 

 

 

 

mysql> SET global transaction isolation level read committed;
Query OK, 0 rows affected (0.00 sec)

 

mysql> SELECT @@global.transaction_isolation;
+--------------------------------+
| @@global.transaction_isolation |
+--------------------------------+
| READ-COMMITTED                 |
+--------------------------------+
1 row in set (0.00 sec)

 

posted on 2023-11-20 18:41  ZhangZhihuiAAA  阅读(14)  评论(0编辑  收藏  举报