Home  >  Article  >  Database  >  How to set transaction isolation level in mysql

How to set transaction isolation level in mysql

王林
王林Original
2020-09-01 15:47:215120browse

Mysql method to set the transaction isolation level: first open the corresponding source code file; then execute the [set session transaction isolation level read uncommitted] command to set the transaction isolation level.

How to set transaction isolation level in mysql

The operating environment of this article: Windows7 system, Dell G3 computer, mysql8.

Isolation level

The isolation level of a transaction is divided into: uncommitted read (read uncommitted), committed read (read committed), repeatable read (repeatable read), serializable (serializable) ).

Uncommitted read

A transaction has been executed but not committed; B transaction queries the updated data of A transaction; A transaction rolls back; ---Dirty data appears

Committed read

A transaction performs an update; B transaction queries; A transaction performs an update again; when B transaction queries again, the two data are inconsistent; ---Non-repeatable read

Repeatable read

No matter how many times transaction A is executed, as long as it is not submitted, the query value of transaction B will not change; transaction B only queries the data snapshot at the moment when transaction B starts;

String Rowization

does not allow concurrent reading and writing operations. When writing is executed, reading must wait;

(recommended related tutorials:mysql tutorial)

Specific Command:

//设置mysql的隔离级别:set session transaction isolation level 事务隔离级别
//设置read uncommitted级别:set session transaction isolation level read uncommitted;
//设置read committed级别:set session transaction isolation level read committed;
//设置repeatable read级别:set session transaction isolation level repeatable read;
//设置serializable级别:set session transaction isolation level serializable;

(Video tutorial recommendation: mysql video tutorial)

The above is the detailed content of How to set transaction isolation level in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn