Documentation Home
MySQL Connector/Python Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.6Mb
PDF (A4) - 0.6Mb
HTML Download (TGZ) - 83.0Kb
HTML Download (Zip) - 95.6Kb

11.2 _mysql_connector.MySQL() Class


ccnx = _mysql_connector.MySQL(args)

The MySQL class is used to open and manage a connection to a MySQL server (referred to elsewhere in this reference as the MySQL instance). It is also used to send commands and SQL statements and read results.

The MySQL class wraps most functions found in the MySQL C Client API and adds some additional convenient functionality.

import _mysql_connector

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

Permitted arguments for the MySQL class are auth_plugin, buffered, charset_name, connection_timeout, raw, use_unicode. Those arguments correspond to the arguments of the same names for MySQLConnection.connect() as described at Section 7.1, “Connector/Python Connection Arguments”, except that charset_name corresponds to charset.

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.