Link to home
Start Free TrialLog in
Avatar of technoparkcorp
technoparkcorpFlag for United States of America

asked on

How to resolve a deadlock in MySQL?

When I start new transaction in MySQL sometimes I get an error:

(1205) Lock wait timeout exceeded; try restarting transaction

How can I resolve this deadlock in such case? In other words, I want to KILL the transaction which created this deadlock. Can I do this?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

that error is NOT a deadlock, but a simple lock.

now, to find the session, I found nothing but some forum entry saying:
<...>
Run mysqladmin debug
Then, the list of locks will be listed in the error log file.
<...>

hope this helps
Avatar of technoparkcorp

ASKER

I want to kill a transaction right from my PHP script. Not manually from console
in other words, how can I kill ALL transactions in MySQL?
the simplest would be the restart MySQL.
otherwise, to see all sessions:
http://dev.mysql.com/doc/refman/5.0/en/show-processlist.html

to kill a session:
http://dev.mysql.com/doc/refman/5.0/en/kill.html
any chance to kill a transaction?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial