Documentation Home
Connectors and APIs Manual
Download this Manual
PDF (US Ltr) - 4.5Mb
PDF (A4) - 4.5Mb


6.9.2.5 MySQLConnection.connect() Method

Syntax:

MySQLConnection.connect(**kwargs)

This method sets up a connection, establishing a session with the MySQL server. If no arguments are given, it uses the already configured or default values. For a complete list of possible arguments, see Section 6.7.1, “Connector/Python Connection Arguments”.

Arguments:

  • kwargs: Connection arguments.

Example:

cnx = MySQLConnection(user='joe', database='test')

For a connection obtained from a conection pool, the connection object class is PooledMySQLConnection. A pooled connection differs from an unpooled connection as described in Section 6.8.4, “Connector/Python Connection Pooling”.