title: How can I rollback a transaction on error in MySQL?
body: <pre><code>update my_table set limit_id = 2 where id='176846';
  
  start transaction;
  update my_table set limit_id = 1 where id='176846';
  update my_table set limit_id = 4 where id='176846';  --  &lt;- this one fails
  commit;
  
  select limit_id from my_table where id='176846';
  </code></pre>
  
  <p>I would like to roll this back automatically - I want the script to output <code>2</code>, not <code>1</code>.  I have no access to the connection policy in use.</p>