Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL transaction autocommit autocommit

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MySQL transaction autocommit autocommit

The default mode of operation of MySQL is the autocommit autocommit mode. This means that each query is automatically executed as a separate transaction unless a transaction is explicitly started. We can change the auto-commit autocommit mode by setting the value of autocommit.

You can view the current autocommit mode with the following command

Mysql > show variables like 'autocommit';+-+-+ | Variable_name | Value | +-+-+ | autocommit | ON | +-+-+ 1 row in set (0.04 sec)

From the query results, we find that the value of Value is ON, which means that autocommit is on. We can change this pattern with the following SQL statement

1mysql > set autocommit = 0

A value of 0 is the same as OFF, and of course, 1 means ON. By setting autocommit=0 above, the user will remain in a transaction until a commit commit or rollback statement is executed to end the current transaction and restart a new transaction.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report