发布时间:2019-09-25 08:20:07编辑:auto阅读(1990)
pymysql 连接Inception ,在判断版本时会出现value error 问题。
原因是pymysql通过‘.’进行分割,但是Inception的版本信息是这样的
./mysql -V
Ver 14.14 Distrib Inception2.1.50, for Linux (x86_64) using EditLine wrapper
oracle mysql的版本是:
mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper
因此Pymysql获取到的值为Inception2,最后int() 报value error。
可以简单修改pymysql connections.py(只是解决了问题,对具体代码还不是很了解)
def _request_authentication(self): # https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse if self.server_version.split('.', 1)[0] == 'Inception2': self.client_flag |= CLIENT.MULTI_RESULTS elif int(self.server_version.split('.', 1)[0]) >= 5: self.client_flag |= CLIENT.MULTI_RESULTS
;
使用Pymysql connection配置可以是下面这样
conn = pymysql.connect(host='127.0.0.1', user='', passwd='', db='', port=6669, autocommit=True, cursorclass=pymysql.cursors.DictCursor, charset='utf8mb4' )
上一篇: Python3网络爬虫实战-28、解析库
下一篇: Python3网络爬虫实战-16、Web
49186
48344
39066
36181
30589
27387
26385
21215
21060
19399
192°
203°
312°
511°
348°
1035°
1039°
1022°
1020°
974°