Auto commit for MySQL databases

In corporate database systems, it is generally preferred to build transaction stacks. This allows for having multiple database statements run and be finally committed if everything is ok. In MySQL, auto commit is on by default; which means that every statement is instantly committed. To check the value of auto commit, run the following MySQL command:

mysql>select @@autocommit;

So in order to turn off auto commit, run the following command in MySQL:

mysql>SET autocommit=0

If you want auto commit turned off permanently, we need to edit your my.cnf file. In the [mysqld], add the following line:

init_connect='SET autocommit=0'

Restart MySQL and you are now ready to do full transaction processing.