HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Why can't I change the isolation levels of my connection in MySQL?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whythecanisolationmysqllevelschangeconnection

Problem

I am trying to experiment a bit with the isolation level of MySQL in a test environment.

I do the following:

mysql> set @@session.tx_isolation='READ-UNCOMMITED';
ERROR 1231 (42000): Variable 'tx_isolation' can't be set to the value of 'READ-UNCOMMITED'


This also fails:

mysql> update information_schema.session_variables set variable_value='READ-UNCOMMITED' where variable_name='TX_ISOLATION';
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'


What am I doing wrong here? I am root. So it should not be a rights issue.

Solution

You need to try

SET tx_isolation = 'READ-UNCOMMITTED';


or

SET SESSION tx_isolation = 'READ-UNCOMMITTED';


You could also declare it at the start of the transaction

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;


Give it a Try !!!
CAVEAT

Please note that you misspelled READ-UNCOMMITED (Missing T). It should be READ-UNCOMMITTED

You cannot change tx_isolation in the INFORMATION_SCHEMA database because it is an in-memory read-only database.

Code Snippets

SET tx_isolation = 'READ-UNCOMMITTED';
SET SESSION tx_isolation = 'READ-UNCOMMITTED';
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

Context

StackExchange Database Administrators Q#50716, answer score: 6

Revisions (0)

No revisions yet.