Query mysql transaction isolation level 1. view the current session isolation level
Select @ tx_isolation;
2. view the current isolation level of the system
Select @ global. tx_isolation;
3. set the current session isolation level
Set session transaction isolatin level repeatable read;
4. set the current isolation level of the system
Set global transaction isolation level repeatable read;
5. command line, when starting the transaction
Set autocommit = off or start transaction
Isolation level
1. read uncommitted
We can see uncommitted data (dirty reads). For example, you believe what others say, but maybe they just talk about it and don't actually do it.
2. read committed
Read the submitted data. However, the data read results may be inconsistent (repeated reading is not allowed, phantom reading ). Read/Write: Read row data can be written.
3. repeatable read (default MySQL isolation level)
It can be read repeatedly, but there is phantom read. Read/write View: read data rows cannot be written, but data can be added to the table. In MySQL, the newly added data of other transactions is invisible and does not generate phantom reads. Multi-version concurrency control (MVCC) mechanism is used to solve Phantom read problems.
4. serializable
Readable and not writable. Like a lock in java, writing data must wait until another transaction ends.
For an understanding of the isolation level, see the andyhu1007 article: http://www.iteye.com/topic/322382
Default isolation level: RR