我使用python在mysql中调用一个表并执行查询。我收到了一个错误:
_mysql_exceptions.OperationalError: (1205, 'Lock wait timeout exceeded; try restarting transaction')tbl_1是一个表,我必须在其中更新isprocessed列。
cursor.execute('UPDATE tbl_1 SET isprocessed=1 where name='+body)
cursor.close()
cursor1 = db.cursor()
cursor1.execute('SELECT name,height,age,weight from tbl_1 where name='+body)主体正在接受消息queue.If中的值,我运行代码时不需要更新查询,它运行良好。我原以为cursor.close会解决这个问题,但它没有解决,我也重新启动了mysql。我也经历过类似的问题,但没有一个能解决我的issue.Any帮助。
我将innodb_lock_wait_timeout设置为50到63000
发布于 2017-06-03 07:25:27
由于种种原因,这是一个常见的问题。
{your_connection_object}.commit()提交事务。例:self.conn.commit()要调试的命令如下(如果您是新手,请阅读有关它们的更多信息):
INNODB监视器输出:
SHOW ENGINE INNODB STATUS\G当前正在运行的进程:
Show processlist;杀死一个特定的过程:
kill *process_id*;当前运行的事务:
SELECT * FROM `information_schema`.`innodb_trx` ORDER BY `trx_started`;https://stackoverflow.com/questions/22008561
复制相似问题