如何检测Mysql/innodb中的死锁? [英] How to detect deadlocks in Mysql / innodb?

查看:324
本文介绍了如何检测Mysql/innodb中的死锁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在Innodb中使用事务时不可避免地会发生死锁,并且如果应用程序代码对其进行了正确处理,则死锁是无害的-如手册所述,只需重试一次即可."

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.

所以我在想-您如何检测死锁?死锁会发出一些特殊的mysql错误号吗?如果重要的话,我正在使用PHP的mysqli扩展名.

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.

谢谢.

找到解决方案,请参阅注释

solution found, see comments

推荐答案

http://dev.mysql.com/doc/refman/5.0/en/innodb-error-codes.html

1213(ER_LOCK_DEADLOCK)

1213 (ER_LOCK_DEADLOCK)

事务死锁.您应该重新运行 交易.

Transaction deadlock. You should rerun the transaction.

这篇关于如何检测Mysql/innodb中的死锁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆