MySQL8.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;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容