O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Autocommit

By default, autocommit is ON, which means that all individual statements are committed as soon as they are executed unless they are in a BEGIN...COMMIT block. If autocommit is OFF, you need to explicitly issue a COMMIT statement to commit a transaction. To disable it, execute:

mysql> SET autocommit=0;

DDL statements, such as CREATE or DROP for databases and CREATE, DROP, or ALTER for tables or stored routines cannot be rolled back.

There are certain statements such as DDLs, LOAD DATA INFILE, ANALYZE TABLE, replication-related statements and so on that cause implicit COMMIT. For more details on these statements, refer https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required