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,& ...
随机推荐
- centos7.4安装redis
参考连接 https://blog.csdn.net/qq_19399235/article/details/78313633/
- 09_ for 练习 _ FlowerNumber
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- linux中vi编辑
crt退出全屏:点击Alt+enter键 linux上传下载文件 Xftp.Filezilla.Winscp等工具 命令 sz test.txt #下载test.txt文件 ...
- Selenium 3----设置元素等待
在做Web应用的自动化测试时,定位元素必不可少,这个过程经常出现定位不到元素的情况,常见原因有哪些呢? 1.描述错误 提高编写水平.细心 2.Frame/Iframe框架原因 在元素所在框架里定位该元 ...
- ping vs telnet, what is the difference between them and when to use which?
Ping is an ICMP protocol. Basically any system with TCP/IP could respond to ICMP calls if they were ...
- C#中$的用法
class Program { static void Main(string[] args) { string tbName = "User"; string colName = ...
- C++编程剖析 问题 方案 和设计准则
1.Set的每个对象为什么会有三个指针? STL中的set使用方法详细!!!! 因为其底层是红黑树实现的,每个节点有两个子节点和一个父节点,所以需要三个指针. Set 与 map的区别是什么? 总的来 ...
- nmap用法
Nmap 7.70SVN ( https://nmap.org ) Usage: nmap [Scan Type(s)] [Options] {target specification} TARGET ...
- windows 操作系统发展过程
1.Windows 1.0 1985年5月推出Windows 1.0,是比尔.盖茨在苹果公司的Apple Lisa系统的GUI界面上得到的启发.Windows 1.0的GUI(图形用户界面)是基于字符 ...
- oracle_dataGuard_11G
[李红]--切记_从库只安装实例_不需要 dbca 创建数据库 但是 netca 创建监听看个人喜欢,我反正是创建了.[DataGuard_主数据库的参数配置]1.启用 force logging 功 ...