MySQL Connector/Python Developer Guide  /  The Connector/Python C Extension  /  The _mysql_connector C Extension Module

8.2 The _mysql_connector C Extension Module

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:

import _mysql_connector

ccnx = _mysql_connector.MySQL()
ccnx.connect(user='scott', password='password',
             host='', database='employees')

ccnx.query("SHOW VARIABLES LIKE 'version%'")
row = ccnx.fetch_row()
while row:
  row = ccnx.fetch_row()


For more information, see Chapter 11, Connector/Python C Extension API Reference.