可以通过命令行设置全局 或 会话的隔离级别。重启或者退出会话失效
SET [SESSION | GLOBAL] TRANSACTION ISOLATION LEVEL {READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE}
具体命令
# 设置全局隔离级别 set global transaction isolation level REPEATABLE READ; set global transaction isolation level READ COMMITTED; set global transaction isolation level READ UNCOMMITTED; set global transaction isolation level SERIALIZABLE; #设置会话隔离级别 set session transaction isolation level REPEATABLE READ; set session transaction isolation level READ COMMITTED; set session transaction isolation level READ UNCOMMITTED; set session transaction isolation level SERIALIZABLE;
通过配置文件设置隔离级别
[mysqld] transaction-isolation = REPEATABLE-READ transaction-isolation = READ-COMMITTED transaction-isolation = READ-UNCOMMITTED transaction-isolation = SERIALIZABLE
查看隔离级别
SELECT @@GLOBAL.transaction_isolation SELECT @@SESSION.transaction_isolation show variables like '%iso%';
https://dev.mysql.com/doc/refman/5.7/en/set-transaction.html
最新评论: