mysql 设置隔离级别
查询显示当前的隔离级别
mysql> show global variables like '%isolation%'; +-----------------------+-----------------+ | Variable_name | Value | +-----------------------+-----------------+ | transaction_isolation | REPEATABLE-READ | +-----------------------+-----------------+ 1 row in set (0.00 sec)
设置隔离级别
mysql> set global transaction_isolation ='read-committed'; Query OK, 0 rows affected (0.00 sec) mysql> show global variables like '%isolation%'; +-----------------------+----------------+ | Variable_name | Value | +-----------------------+----------------+ | transaction_isolation | READ-COMMITTED | +-----------------------+----------------+ 1 row in set (0.00 sec)
查看隔离级别也可以(前提是知道具体变量名):
mysql> select @@transaction_isolation; +-------------------------+ | @@transaction_isolation | +-------------------------+ | REPEATABLE-READ | +-------------------------+ 1 row in set (0.00 sec)
参考:
https://www.jianshu.com/p/6738c4b11da8