Tag Archives: Lock wait timeout exceeded

MySQL Lock Error: Lock wait timeout exceeded [How to Solve]

Problem Description:

Execute insert or update, delete, error code: 1205. Lock wait timeout exceeded; try restarting transaction

Solution:

#1. View transaction table

select * from information_schema.innodb_trx

TRX was found in the results_ mysql_ thread_ ID has value xxxx (number)

#2. Operation–   There will be a piece of data corresponding to xxxx (number) in the result

show processlist

#3. Execute in SQL

kill xxxx

Cause analysis:

The InnoDB storage engine of MySQL supports transactions. After the transaction is started, it is not actively committed. This causes the resource to be occupied for a long time. When other transactions preempt the resource, the preemption fails due to the lock of the previous transaction! Therefore, lock wait timeout exceeded appears