View Isolation level of MySQL transaction

1. Select the database to view the current transaction isolation sector

select @@tx_isolation;

2. Open the transaction, roll back the transaction

3. Dirty read, phantom read in the transaction level

4. MySQL transaction Autocommit setting, every sql must be submitted with commit to take effect.

The default operation mode of MySQL is autocommit automatic submission mode. This means that unless a transaction is explicitly started, each query is automatically executed as a separate transaction. We can change whether it is autocommit mode by setting the value of autocommit.

You can view the current autocommit mode through the following command

show variables like < span style="color: #ff0000;">'autocommit' ;

Turn off automatic submission, and each SQL must be submitted through the commit command.

mysql> set autocommit = 0;

https://blog.csdn. net/f110300641/article/details/83988706

Related: https://www.cnblogs.com/fps2tao /p/7894505.html

select @@tx_isolation;

show variables like 'autocommit';

mysql> set autocommit = 0 ;

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3004 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.