A transaction is a sequential group of database manipulation operations, which is performed as if it were one single work unit.

These statements provide control over use of transactions:

  • START TRANSACTION or
    BEGIN start a new transaction.

  • COMMIT commits the current transaction,
    making its changes permanent.

  • ROLLBACK rolls back the current
    transaction, canceling its changes.

  • SET autocommit disables or enables the
    default autocommit mode for the current session.

mysql_transaction

MySQL transaction example