Some people believe that the ability to commit or rollback
multiple statements as a single unit is a defining characteristic
of the concept of transactions. They draw the -false- conclusion
that enabling autocommit is the same as disabling transactions.
It is easy to demonstrate why this is not true.
Autocommit
With autocommit enabled, every statement is wrapped within
its own transaction. Successful execution of a statement is
implicitly followed by a COMMIT
, and the occurrence
of an error aborts the transaction, rolling back any
changes.
By default, autocommit is enabled in MySQL. You can check the
current setting by executing the following statement:
mysql> select @@autocommit;
+--------------+
| @@autocommit |
+--------------+
| 1 |
+--------------+
1 row in set (0.00 sec)
The @@
prefix …