MySQL defaults to autocommit

How do I know?  On a new install of WordPress with MySQL…

MariaDB [wordpress]> show global variables like ‘autocommit’;
+—————+——-+
| Variable_name | Value |
+—————+——-+
| autocommit | ON |
+—————+——-+
1 row in set (0.00 sec)

This variable is set at the session level as follows.
Turn off autocommit:

set autocommit = 0;

Turn on autocommit:

set autocommit = 1;

Since it is at the session level – you have to do something like this – to change it every session.

In the file /etc/my.cnf
[mysqld]
 init_connect='SET autocommit=0'

Leave a Comment

Scroll to Top