title: Block MySQL reads while updating
body: <p>I have two simple queries one reading and one updating a table. How can I lock the read for the select query while the update one is running. Right now in MySQL InnoDB I noticed that the write/update is by default locked but the read/select is getting the old data before the transaction.</p>
  
  <p>I tried using a transaction in the update query and then <code>SELECT ... FOR UPDATE</code> - outside of the transaction - but it didnt seem to do the trick. Also I was wondering, for testing purposes, how to slow down the UPDATE query. I came across SLEEP(X), but I dont know how to implement it inside the update query.</p>
  
  <p>How can I make every query wait read/write until a write is completed.</p>