Autocommit Mode

By default, the system variable AUTOCOMMIT is set to 1, which instructs MariaDB to process each database-manipulation statement issued immediately as a single transaction. This is the behavior you have already seen, with an INSERT, UPDATE, or DELETE committed to the database as soon as you issue the command.

Consider this simple UPDATE statement:

UPDATE PRODUCTS SET price = 5.99
WHERE code = 'MINI';

When autocommit mode is turned on, the previous statement is executed as if you had entered the following:

BEGIN TRANSACTION;
UPDATE PRODUCTS SET price = 5.99
WHERE code = 'MINI';
COMMIT;

By setting the value of AUTOCOMMIT to 0, you disable this feature so that you have to use COMMIT to store any changes madeor use ROLLBACK to discard changessince the beginning of the transaction.

To disable AUTOCOMMIT, use the SET command as shown:

MariaDB> SET AUTOCOMMIT=0;
Query OK, 0 rows affected (0.00 sec)

Previous Page Next Page