Audit Lock
Audit Lock

Reputation: 27

'SET AUTOCOMMIT=0;' failed after I execute it

I have a InnoDB MySQL table.
At the beginning, the autocommit is ON.

And I tried to run this:

SET AUTOCOMMIT=0;
SHOW VARIABLES WHERE Variable_name='autocommit';

Then execute it.
Yeah, it really shows autocommit is OFF after I execute this command


But when I try to run this again:

SHOW VARIABLES WHERE Variable_name='autocommit';

The autocommit return to ON again.
Why?
Is there any way to set autocommit to OFF forever?

Upvotes: 0

Views: 219

Answers (1)

nos
nos

Reputation: 229184

No there isn't, autocommit is per session(another name for a "connection").

You can explicitly disable autocommit once per connection you make to the database, the setting applies to only that connection.

Upvotes: 2

Related Questions