SET AUTOCOMMIT¶
Use SET AUTOCOMMIT to configure automatic commit outside explicit transactions for the current session. 1 / ON enables it; 0 / OFF disables it. Inspect the value with SHOW VARIABLES LIKE 'autocommit'.
Syntax¶
SET AUTOCOMMIT = {0 | 1 | OFF | ON};
Example¶
Disable automatic commits, enable them again, and inspect the restored setting in the same client connection:
SET AUTOCOMMIT = OFF;
SET AUTOCOMMIT = ON;
SHOW VARIABLES LIKE 'autocommit';
Session settings apply to the current connection. After disabling automatic commits, end the transaction with COMMIT or ROLLBACK in that connection. Before submitting SQL in separate platform or API requests, confirm whether the entry point preserves the same database session.
See Transactions, COMMIT, and ROLLBACK.
Last updated on