我有进行 SQL 更新的 Flask 应用程序:
query = 'update tbl set x="bla" where filename=%s';
cursor.execute(query, fileName)
此代码适用于多个文件。 突然我在更新时开始遇到这个错误(错误在每次更新调用中再次出现)。
InternalError: (1205, u'Lock wait timeout exceeded; try restarting transaction')
但这并没有解决我的问题。
试图杀死一些正在休眠的进程,但没有成功。
来自 SHOW ENGINE INNODB STATUS
的信息:
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 1136, 5 row lock(s)
MySQL thread id 439228, OS thread handle 139653215057664, query id 7055088 10.66.85.134 admin updating
update tbl set vt_status=\"rescan\" where filename=\'3ec7il\'
Trx read view will not see trx with id >= 131151, sees < 131145
最佳答案
尝试/except
终于解决了
try:
conn = getConn()
finally:
conn.close()
关于python - 超过锁定等待超时;尝试重新启动事务 MYSQL Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50087147/