Updating data with UPDATE statement in MySQL error: Lock wait timeout exceeded; Try restarting transaction.
This is because the lock on the table you want to update is in the hands of other threads, and if there is no accident, it is likely that the lock is held in the transaction thread, by killing the thread.
Querying all threads of the current database with show full processlist
Use SELECT * from INFORMATION_SCHEMA. Innodb_trx queries the database transaction table, where trx_mysql_thread_id is the ID of the transaction thread, referring to the thread information in the show full Processlist command.
Use command: Kill transaction thread ID kills it, for example: Kill 99999
Then use show full processlist to query all threads of the current database and find that the thread is gone.
Finally, the UPDATE statement is executed again.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MySQL exception lock wait timeout exceeded; Try restarting transaction