Get the App
SLTechnology News&Howtos  ›  Database  › 

Python 3 problems connecting to Inception using pymysql

Shulou Source: shulou.com Published: 2022-06-01 14:47:23 10月04日 Update

When pymysql connects to Inception, there will be a value error problem when judging the version.

The reason is that pymysql passed'.' To split, but the version information for Inception is like this

. / mysql-V

Ver 14.14 Distrib Inception2.1.50, for Linux (x86 / 64) using EditLine wrapper

The version of oracle mysql is:

Mysql Ver 14.14 Distrib 5.7.18, for Linux (x86 / 64) using EditLine wrapper

So the value obtained by Pymysql is Inception2, and finally int () reports to value error.

You can simply modify pymysql connections.py (just solve the problem and don't know much about the specific code)

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

The configuration using Pymysql connection can be as follows

Conn = pymysql.connect (host='127.0.0.1', user='', passwd='', db='', port=6669, autocommit=True, cursorclass=pymysql.cursors.DictCursor, charset='utf8mb4')

Tags: Version problem code information reason just configuration Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi MariaDB Shulou Technology Xiaomi