参考:https://blog.csdn.net/zc474235918/article/details/72731363/
https://blog.csdn.net/zmx729618/article/details/51259135
# import pymysql
# conn=pymysql.connect(host=‘127.0.0.1‘,user=‘root‘,passwd=‘123456‘,db=‘mysql‘,charset=‘utf8‘, port=3306)
# cur=conn.cursor()
# cur.execute(‘use douban;‘)
# cur.execute("insert into douban.douban(author,actor,country) VALUES(‘aa‘,‘bb‘,‘bb‘)")
# conn.commit()
# cursor.close()
cursor未关闭时会出现lock wait timeout exceeded错误解决办法:
SELECT * FROM information_schema.INNODB_TRX\G;
找到对应的trx_mysql_thread_id,然后执行kill id;
即可解决
原文地址:https://www.cnblogs.com/lajiao/p/9367838.html
时间: 2024-09-28 03:06:58