pymysql.err.InternalError: Packet sequence number wrong - got 45 expected 0
原因:
使用了多线程,多线程共享了同一个数据库连接,但每个execute前没有加上互斥锁
方法:
方法一:每个execute前加上互斥锁
lock.acquire()
cursor.execute(command,data)
lock.release()
方法二:
每个线程拥有自己的数据库连接,即在线程调用函数中加上数据库连接代码
方法三:
所有线程共用一个连接池,需要考虑线程总数和连接池连接数上限的问题
pymysql.err.InternalError: Packet sequence number wrong - got 45 expected 0的更多相关文章
- pymysql.err.InternalError: (1054, "Unknown column 'None' in 'field list'")
错误提示: Traceback (most recent call last): File "D:/projectwc/test/dd.py", line 43, in <m ...
- OpenStack安装keyston 错误BError: (pymysql.err.InternalError) (1071, u‘Specified key was too long; max key length is 767 bytes‘) [SQL: u‘\nCREATE TABLE migrate_ver
折腾了两天的错误,BError: (pymysql.err.InternalError) (1071, u‘Specified key was too long; max key length is ...
- 报错:pymysql.err.InternalError: (1054, "Unknown column 'AType' in 'field list'")
报错背景: 报错前sql代码展示: List = ['] # sql = "insert into test(id, name) value ("+"'"+ L ...
- pymysql.err.InternalError: (1205, 'Lock wait timeout exceeded; try restarting transaction')错误处理
问题描述: 在使用pymysql库时,利用游标执行插入操作,产生错误,会出现pymysql.err.InternalError: (1205, 'Lock wait timeout exceeded; ...
- 解决pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9F\\x8C\\xB8' for column 'headline' at row 1")
解决pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9F\\x8C\\xB8' for column ...
- sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1091, "Can't DROP 'users_ibfk_1'; check that column/key exists") [SQL: ALTER TABLE users DROP FOREIGN KEY users_ibfk_1]
flask 迁移数据库报错 报错: sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1091, "Can't DROP ...
- sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1366, "Incorrect string value: '\\xE6\\xB1\\x89\\xE8\\xAF\\xAD...' for column 'className' at row 1") [SQL: INSERT INTO classmessage (`classId
sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1366, "Incorrect string value: '\\xE ...
- Mysql失败,异常pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9D\\x90\\xBF;......
问题描述: 插入Mysql时失败了,python代码报如下异常: pymysql.err.InternalError: (1366, "Incorrect string value: '\\ ...
- python pymysql.err.InternalError: (1366, "Incorrect string value: '\\xE9\\x9F\\xA9\\xE6\\xA2\\x85...
python3使用pymysql报错: image.png 代码: #插入数据 try: sql = 'INSERT INTO classb (a_id,name,age) VALUES (6,& ...
随机推荐
- 省市区地址三级联动jQuery插件Distpicker使用
插件下载地址 http://www.jq22.com/jquery-info8054 效果如下: 使用: 1.引入js <script src="http://www.jq22.com ...
- 英语口语练习系列-C38-颜色-谈论日常活动
词汇颜色 color red passion green peace energy blue calm purple mystery yellow royal 询问日常生活 When do you g ...
- 程序一 用记事本建立文件src.dat,其中存放若干字符。编写程序,从文件src.dat中读取数据,统计其中的大写字母、小写字母、数字、其它字符的个数,并将这些数据写入到文件test.dat中。
用记事本建立文件src.dat,其中存放若干字符.编写程序,从文件src.dat中读取数据,统计其中的大写字母.小写字母.数字.其它字符的个数,并将这些数据写入到文件test.dat中. #inclu ...
- python学习:注释、获取用户输入、字符串拼接、运算符、表达式
注释 #为单行注释'''三个单引号(或者"""三个双引号)为多行注释,例如'''被注释的内容''' '''三个单引号还可以起到多行打印的功能. #ctrl+? 选中的多行 ...
- HTML入门2
开始将注意力转移到具体的元素里和页面了. 在页面加载完成的时候,标签head里的内容不会显示出来,包含了页面的title和css样式以及一些元素据信息,比如作者,描述文档,下面将具体分析html文档里 ...
- P1316 丢瓶盖--(二分答案)
题目描述 陶陶是个贪玩的孩子,他在地上丢了A个瓶盖,为了简化问题,我们可以当作这A个瓶盖丢在一条直线上,现在他想从这些瓶盖里找出B个,使得距离最近的2个距离最大,他想知道,最大可以到多少呢? 输入输出 ...
- 解决Tomcatt下连接数据库的classNoFount问题
在数据库连接单独使用的时候.即作为一个独立类建立在mian方法中,可以正确的使用.例:连接MySql数据库 import java.sql.*; public class SQLtest { // J ...
- 一个简单的分布式session框架
该代码只是用来学习原理的,有很多不完善之处. 代码: git@github.com:sicw/EasySpringSession.git 一. 整体设置 1. 实现Filter,封装新的reques ...
- jquery全选 不全选
<input type="checkbox" id="check">点击 <input type="checkbox" c ...
- weakhashmap简单理解
map中的key(注意String,和元数据作key有特殊性),gc后会被立马干掉, key被干掉后,其对应的entry将被存入queue中 /** * Reference queue for cle ...