MySQL exception lock wait timeout exceeded; Try restarting transaction

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.