title: sql transactions, why user can update
body: <p>I am learning transactions in mysql. I cannot understand behaviour. Isolation level for my db is repeatable-read. Database schema:</p>
  
  <pre><code>creade database my_db;
  use my_db;
  create table locktest(
      id integer,
      val integer,
      primary key (id)
  );
  insert into locktest (id, val) values (3,6);
  </code></pre>
  
  <p>I created two users. User1 does next:</p>
  
  <pre><code>start transaction;
  select * from locktest where id = 3;
  </code></pre>
  
  <p>get id = 3, val = 6;</p>
  
  <p>Then, user2 updates:</p>
  
  <pre><code>update locktest set val = 7 where id = 3;
  select * from locktest where id = 3;
  </code></pre>
  
  <p>result is id = 3, val = 7;</p>
  
  <p>user1 selects:</p>
  
  <pre><code>select * from locktest where id = 3;
  </code></pre>
  
  <p>id = 3, val = 7</p>
  
  <p>So, my question why can user2 update the table, should not be it locked by user1?
  And why in last select from user1 it gets updated values, should not be it consistent according to <a href="http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html#isolevel_repeatable-read" rel="nofollow">repeatable read isolation level</a>?</p>