Transaction Statements

This section provides information on SQL statements available in MySQL for transactions. Transactions are a set of SQL statements that the server has to execute as a unit; either all succeed or all fail. If the server detects that all have succeeded, it commits the transaction; if any statement fails, the server rolls back the previous statements. Transactions are supported by the InnoDB, BDB, and NDB Cluster storage engines, as well as some new storage engines for MySQL that are under development. Statements that manipulate transactions are ignored if executed against a storage engine that doesn't support transactions, notably MyISAM.

BEGIN

Use this MySQL statement to start a transaction.

COMMIT

Use this MySQL statement to commit transactions, which are SQL statements that have changed data and that have been entered into MySQL but not yet saved.

RELEASE SAVEPOINT

This MySQL statement instructs the server to release a savepoint named earlier with the SAVEPOINT statement for the current transaction.

ROLLBACK

Use this MySQL statement with transactional tables to reverse transactions that have not yet been committed.

This MySQL statement instructs the server to reverse SQL statements for the current transaction back to a point marked in the transaction by the SAVEPOINT statement.

SAVEPOINT

Use this MySQL statement to identify a point in a transaction to which SQL statements may potentially be undone later.

SET TRANSACTION

Use this MySQL statement to set an isolation level for the current transaction, for a transaction that's about to be started, or globally.

START TRANSACTION

Use this MySQL statement to start a transaction.