How To View and Change the Current Transaction Isolation Level

Q

How To View and Change the Current Transaction Isolation Level? - MySQL FAQs - Transaction Management: Commit or Rollback

✍: FYIcenter.com

A

If you want to view or change the current transaction isolation level, you can use the following commands:

  • SELECT @@TX_ISOLATION FROM DUAL; -- Viewing the current transaction isolation level.
  • SET TRANSACTION ISOLATION LEVEL levelName; -- Changing the current transaction isolation level.

The tutorial exercise below shows you how to view and change transaction isolation level:

>\mysql\bin\mysql -u dev -piyf fyi

mysql> SELECT @@TX_ISOLATION FROM DUAL;
+-----------------+
| @@TX_ISOLATION  |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.46 sec)

mysql> SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
Query OK, 0 rows affected (0.10 sec)

mysql> SELECT @@TX_ISOLATION FROM DUAL;
+----------------+
| @@TX_ISOLATION |
+----------------+
| READ-COMMITTED |
+----------------+
1 row in set (0.02 sec)

2007-05-11, 5136👍, 0💬