10.2.35 MySQLConnection.autocommit Property

This property can be assigned a value of True or False to enable or disable the autocommit feature of MySQL. The property can be invoked to retrieve the current autocommit setting.


Autocommit is disabled by default when connecting through Connector/Python. This can be enabled using the autocommit connection parameter.

When the autocommit is turned off, you must commit transactions when using transactional storage engines such as InnoDB or NDBCluster.

>>> cnx.autocommit
>>> cnx.autocommit = True
>>> cnx.autocommit