We've been seeing some deadlocks occur but have not been able to reproduce. Is there any way to determine, after the fact, what queries were running, etc to figure out why deadlock occurred?

2 Answers 2


SHOW INNODB STATUS will give you the last detected deadlock.

  • 4
    FYI, "SHOW INNODB STATUS" is deprecated. Instead, use "SHOW ENGINE INNODB STATUS" as of MySQL 5.x
    – randomx
    Commented Mar 17, 2011 at 1:14

I found this link in dba.stackexchange.com about deadlocks. In stackoverflow.com, user @Omry addressed how to avoid deadlocks and why they happen March 11, 2010 at 9:48 AM. User @ewernli adresssed this as well.

This involves the queries that access the same set of tables in different order from one query to the next.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.