1 查看当前会话隔离界别
mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.00 sec)
2 查看全局隔离级别
mysql> select @@global.tx_isolation;
+-----------------------+
| @@global.tx_isolation |
+-----------------------+
| SERIALIZABLE |
+-----------------------+
1 row in set (0.00 sec)
3 设置全局隔离级别
mysql> set global tx_isolation = 'SERIALIZABLE';
Query OK, 0 rows affected (0.00 sec)
4 设置当前会话的隔离界别
mysql> set tx_isolation = 'SERIALIZABLE';
Query OK, 0 rows affected (0.00 sec)
mysql> select @@tx_isolation;
+----------------+
| @@tx_isolation |
+----------------+
| SERIALIZABLE |
+----------------+
1 row in set (0.00 sec)
5 系统变量符
格式:
会话级别的系统变量 @@name 或
全局级别的系统变量 @@global.name
比如查询binlog的类型
mysql> select @@binlog_format;
+-----------------+
| @@binlog_format |
+-----------------+
| STATEMENT |
+-----------------+
1 row in set (0.00 sec)