Home  >  Article  >  Daily Programming  >  How to detect automatic transactions in Mysql data table

How to detect automatic transactions in Mysql data table

藏色散人
藏色散人Original
2018-10-31 16:31:473590browse

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.

How to detect automatic transactions in Mysql data table

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.

How to detect automatic transactions in Mysql data table

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn