title: How to debug Lock wait timeout exceeded on MySQL?
body: <p>In my production error logs I occasionally see:</p>
  
  <blockquote>
    <p>SQLSTATE[HY000]: General error: 1205
    Lock wait timeout exceeded; try
    restarting transaction</p>
  </blockquote>
  
  <p>I know which query is trying to access the database at that moment but is there a way to find out which query had the lock at that precise moment?</p>