Custom Search

Wednesday, September 11, 2013

Mysql How to disable dirty reads

Mysql How to enable transaction-isolation READ-COMMITTED

1)
Goto mysql prompt and check transaction-isolation setting
mysql> SELECT @@global.tx_isolation, @@session.tx_isolation, @@tx_isolation;
+-----------------------+------------------------+-----------------+
| @@global.tx_isolation | @@session.tx_isolation | @@tx_isolation  |
+-----------------------+------------------------+-----------------+
| REPEATABLE-READ       | REPEATABLE-READ        | REPEATABLE-READ |
+-----------------------+------------------------+-----------------+
1 row in set (0.00 sec)

2)
Goto 
#vim /etc/mysql/my.cnf



3)
Add following line under [mysqld] section
transaction-isolation = READ-COMMITTED

Example
=====
[mysqld]
transaction-isolation = READ-COMMITTED

4)
Restart mysql
#sudo /etc/init.d/mysql restart

5)
Goto mysql prompt and check transaction-isolation setting
mysql> SELECT @@global.tx_isolation, @@session.tx_isolation, @@tx_isolation;
+-----------------------+------------------------+----------------+
| @@global.tx_isolation | @@session.tx_isolation | @@tx_isolation |
+-----------------------+------------------------+----------------+
| READ-COMMITTED        | READ-COMMITTED         | READ-COMMITTED |
+-----------------------+------------------------+----------------+
1 row in set (0.00 sec)

No comments:

Post a Comment