Python 3 using PyMySQL to connect to Inception
When using PyMySQL to connect to the Inception, a value error occurs when determining the version. The reason is that pymysql is separated by '.', but the version information of Inception is
./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
Therefore, the value obtained by Pymysql is Inception2, And the last int () reports a value error.
You can simply modify pymysql connections. py (only solves the problem and is not familiar with 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] = 'exception2 ':
Self. client_flag | = CLIENT. MULTI_RESULTS
Elif int (self. server_version.split ('.', 1) [0])> = 5:
Self. client_flag | = CLIENT. MULTI_RESULTS
;
Use Pymysql connection configuration as follows:
Conn = pymysql. connect (host = '2017. 0.0.1 ',
User = '',
Passwd = '',
Db = '',
Port = 6669,
Autocommit = True,
Cursorclass = pymysql. cursors. DictCursor,
Charset = 'utf8mb4'
)