求大神python的mysql 的pymysql.err.InternalError: Packet sequence number wrong - got 4
pymysql.err.InternalError: Packet sequence number wrong - got 45 expected 0
这个错误困扰我很久
代码:
import pymysql
#连接数据库
conn = pymysql.connect(host='192.168.60.128',port= 22,user = 'root',passwd='123456',db='mysql') #db:库名
#创建游标
cur = conn.cursor()
#插入一条数据
# reCount = cur.excute('insert into lcj(name,age) vaules(%s,%s)',('ff',18))
#向test库中的lcj表插入
# ret = cur.executemany("insert into lcj(name,tel)values(%s,%s)", [("kk",13212344321),("kw",13245678906)])
#同时向数据库lcj表中插入多条数据
ret = cur.executemany("insert into lcj values(%s,%s,%s,%s,%s)", [(41,"xiaoluo41",'man',24,13212344332),
(42,"xiaoluo42",'gril',21,13245678948),
(43,"xiaoluo43",'gril',22,13245678949),
(44,"xiaoluo44",'main',24,13543245648)])
#提交
conn.commit()
#关闭指针对象
cur.close()
#关闭连接对象
conn.close()
#打印结果
print(ret)
~
错误Traceback (most recent call last):
File "C:/PycharmProjects/s14/day12/begin_pymysql.py", line 3, in <module>
conn = pymysql.connect(host='192.168.60.128',port= 22,user = 'root',passwd='123456',db='mysql') #db:库名
File "C:\Python\Python36\lib\site-packages\pymysql\__init__.py", line 90, in Connect
return Connection(*args, **kwargs)
File "C:\Python\Python36\lib\site-packages\pymysql\connections.py", line 688, in __init__
self.connect()
File "C:\Python\Python36\lib\site-packages\pymysql\connections.py", line 905, in connect
self._get_server_information()
File "C:\Python\Python36\lib\site-packages\pymysql\connections.py", line 1207, in _get_server_information
packet = self._read_packet()
File "C:\Python\Python36\lib\site-packages\pymysql\connections.py", line 968, in _read_packet
(packet_number, self._next_seq_id))
pymysql.err.InternalError: Packet sequence number wrong - got 45 expected 0