Mysql error “Lock wait timeout exceeded; try restarting transaction”

Question:

I have a simple query to the base

UPDATE users SET username='test' WHERE id='3'

After that, the request hangs for 120 seconds and the error “Lock wait timeout exceeded; try restarting transaction” appears. This only applies to one user, in all other cases everything is fine

show full processlist; command show full processlist; killed all the updates that hung to this user and re-launched this update and still the same.

How can I unlock it?

Answer:

In my case, if you wait a few seconds (for this there is a sleep function in php ) and then run the request again, then everything goes fine.

And if an error also occurs, we wait until it works out.

Scroll to Top
AllEscort