MySQL Error: Lock wait timeout exceeded?

problem description

specific error message is

General error: 1205 Lock wait timeout exceeded; try restarting transaction

the reason for this problem is that there is a process that has been occupying the lock and does not release it. How do you reproduce this problem? How to solve it?

Nov.01,2021

How to debug Lock wait timeout exceeded on MySQL?


mysql-uxxx-ppass-e "show processlist" | grep-I "locked"

or show engine innodb status

find id kill


build a test table on which update does not submit, and another session will not be reproduced if you go to update.
show processlist finds the session that holds the lock, and just drop kill.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e39fc4-26ab7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e39fc4-26ab7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?