Do you need to restore autocommit=1 when MySQL is finished?
Source: Internet
Author: User
Do you need to restore autocommit=1 when the MySQL transaction is complete?
Set autocommit = 0; Turn off auto-commit
Start transaction; Open a transaction;
---------------------......
Commit formally submit a transaction;
After commit, do you want to restore set autocommit = 1? I see no one else's case is restored, the commit will automatically recover?
------to solve the idea----------------------
Autocommit default is 1, which commits transactions automatically
You set autocommit =0 to turn off autocommit, apparently this is your personal behavior
So after the end of the transaction, is it necessary to restore autocommit to 1, which is naturally your personal behavior
You just reconnect to the database, autocommit is still 1, regardless of the state of your last operation. This is the server's behavior.
If you were to execute 100 more transactions after a transaction, would you like to shut down or turn on the automatic commit of the transaction?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.