Forums

Lock wait timeout exceeded; try restarting transaction

Hello , hope someone can help ! query: UPDATE items_mw dt, mw_c tt SET dt.wC = tt.wC WHERE dt.i_id = tt.i_id; rise error : Lock wait timeout exceeded; try restarting transaction

do you have multiple queries updating those rows at the same time?

Hello, I have the same error, occuring multiple times

(mysql.connector.errors.DatabaseError) 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
[SQL: INSERT INTO fb_user (id, signup_on, name, email, token, token_expiration, signup_time, shop_id) VALUES ( (id)s, now(), %(name)s, %(email)s, %(token)s, %(token_expiration)s, %(signu
p_time)s, %(shop_id)s)]
[parameters: {'id': 'xxx', 'name': 'xxx', 'email': 'xxx@gmail.com', 'token':'xxx

xxx', 'token_expiration': 1627915840, 'signup_time': None, 'shop_id': 'xxx.com'}]

I do not have multiple queries updating this at the same time

That error can only happen if there is another transaction that is holding an exclusive lock on the table or row. In general, an exclusive lock is necessary to delete or update a row - https://dev.mysql.com/doc/refman/5.7/en/innodb-locking.html

Is there any way to find out what other transaction this is?

You can use show processlist; in a MySQL console to see other queries that are running. You'll have to try work out from that which one was holding the lock.