MySQL8.0 查询默认事务隔离级别

2019-05-12  本文已影响0人  过往云技

MySQL8.0 已删除原来的 tx_isolation ,改用 transaction_isolation

transaction_isolation was added in MySQL 5.7.20 as an alias for tx_isolation, 
which is now deprecated and is removed in MySQL 8.0. 
Applications should be adjusted to use transaction_isolation in preference to tx_isolation. 

查询默认事务隔离级别

1、show variables like 'transaction_isolation'\G;
2、select @@transaction_isolation\G;
3、SELECT @@GLOBAL.transaction_isolation, @@GLOBAL.transaction_read_only;

检查会话中的事务隔离级别

SELECT @@SESSION.transaction_isolation, @@SESSION.transaction_read_only;

设置事务隔离级别语法:

SET [GLOBAL | SESSION] TRANSACTION
    transaction_characteristic [, transaction_characteristic] ...

transaction_characteristic: {
    ISOLATION LEVEL level
  | access_mode
}

level: {
     REPEATABLE READ
   | READ COMMITTED
   | READ UNCOMMITTED
   | SERIALIZABLE
}

access_mode: {
     READ WRITE
   | READ ONLY
}

To set the session isolation level, use any of these syntaxes:

SET @@SESSION.transaction_isolation = value;
SET SESSION transaction_isolation = value;
SET transaction_isolation = value;

To set the next-transaction isolation level, use this syntax:

SET @@transaction_isolation = value;
上一篇下一篇

猜你喜欢

热点阅读