MySQL Database Transactions

2022年11月11日 14点热度 0人点赞 0条评论
内容目录

MYSQL database transactions support the following isolation levels:

Read Uncommitted
Read Committed
Repeatable Read
Serializable

In each session, the isolation level for transactions can be set, and if not set, the database's default isolation level will be used.

To query the database's default isolation level:

show variables like 'transaction_isolation';
SELECT @@transaction_isolation;

To set the transaction isolation level in the current session:

set session transaction isolation level repeatable read; ## Set the session isolation level to Repeatable Read
begin;
select * from a.b where 1=1;
commit;

痴者工良

高级程序员劝退师

文章评论