title: How to detect deadlocks in Mysql / innodb?
body: <p>I know that deadlocks occur inevitably when using transactions in Innodb and that they are harmless if they are treated properly by the application code - "just try it again", as the manual says.</p>
  
  <p>So I was wondering - how do you detect deadlocks? Does a deadlock issue some special mysql error number? I am using PHP's mysqli extension if that matters.</p>
  
  <p>Thank you.</p>
  
  <p>Edit: solution found, see comments</p>