Home > Article > Daily Programming > How to detect automatic transactions in Mysql data table
This article mainly introduces how to detect automatic transactions in mysql data tables.
For those who have a certain knowledge base of mysql database, they must have a certain understanding of the concept of automatic transactions in mysql. Everyone should know that by default, MySQL data tables enable auto-commit mode, which means automatic transactions are enabled by default. We do not need to manually enable the submission operation.
So how do we detect automatic transactions in mysql data tables? In fact, the operation is also very simple.
Below we will still introduce some simple examples to you about automatic transaction detection.
Command to query automatic transactions:
show variable like 'autocommit';
As shown below, we use the command line tool to query the existing table money.
And use the command statement to query automatic transactions to check the opening of automatic transactions in the money table. As shown in the above figure, automatic transactions are enabled by default in the money table. (ON).
Turn on automatic transaction processing:
set autcommit = on / 0;
Turn off automatic transaction processing:
set autcommit = off / 1;
If we want to turn it off For automatic transactions, you can operate as follows.
At this time, the money table has turned off the automatic transaction (OFF), so if you perform some data processing in the data table later, it will be the same as the manual transaction. The process is the same. After we process the data, we need to manually submit it to the data table so that the data can be updated synchronously.
Of course, in our actual project, if there is a lot of data to be processed, manual transactions are obviously inefficient, so usually mysql data tables are default automatic transactions.
This article is a detailed introduction to automatic transaction detection in mysql data tables. It is also very simple and easy to understand. I hope it will be helpful to friends in need!
If you want to know more about mysql, you can follow the PHP Chinese website mysql video tutorial, everyone is welcome to refer to and learn!
The above is the detailed content of How to detect automatic transactions in Mysql data table. For more information, please follow other related articles on the PHP Chinese website!