You do this in 3 different ways:
Before you do an INSERT
, always issue a BEGIN;
statement. This will turn off autocommits. You will need to do a COMMIT;
once you want your data to be persisted in the database.
Use autocommit=0;
every time you instantiate a database connection.
For a global setting, add a autocommit=0
variable in your my.cnf
configuration file in MySQL.