MySQL Connector/Python Release Notes
To use the C Extension directly, import the
_mysql_connector
module rather than
mysql.connector
, then use the
_mysql_connector.MySQL()
class to obtain a
MySQL
instance. For example:
Press CTRL+C to copyimport _mysql_connector ccnx = _mysql_connector.MySQL() ccnx.connect(user='scott', password='password', host='127.0.0.1', database='employees') ccnx.query("SHOW VARIABLES LIKE 'version%'") row = ccnx.fetch_row() while row: print(row) row = ccnx.fetch_row() ccnx.free_result() ccnx.close()
For more information, see Chapter 11, Connector/Python C Extension API Reference.