title: How to simulate a deadlock on a row in mysql?
body: <p>To simulate a <code>lock</code> in mysql I can grab the row with the following:</p>
  <pre><code>BEGIN;
  SELECT * FROM table WHERE id=1 FOR UPDATE;
  </code></pre>
  <p>Now, if I try and update that row (from another connection) it will raise the following error after <code>innodb_lock_wait_timeout</code> seconds (default: 50):</p>
  <blockquote>
  <p>(1205, 'Lock wait timeout exceeded; try restarting transaction')</p>
  </blockquote>
  <p>How would I simulate a deadlock then, so I get an error that looks like:</p>
  <blockquote>
  <p>Deadlock found when trying to get lock; try restarting transaction”</p>
  </blockquote>
  <p>When I try and query or update the row?</p>
  <hr />
  <p><strong>Update</strong>: even when trying to simulate <a href="https://dev.mysql.com/doc/refman/5.7/en/innodb-deadlock-example.html" rel="nofollow noreferrer"><code>the mysql deadlock example</code></a>, I get <code>Lock wait timeout exceeded; try restarting transaction</code> rather than a <code>deadlock</code> message.</p>