PrefaceThis article mainly introduces how to start a transaction in MySQL. You can also refer to the official documentation for related information. https://dev.mysql.com/doc/refman/8.0/en/commit.html Method 1START TRANSACTION or BEGIN starts a new transaction COMMIT commits the current transaction ROLLBACK rolls back the current transaction This is a well-known method, in which the methods of starting a transaction, start transaction and begin, are the same. Method 2SET autocommit = 0; By default, autocommit = 1, which means that transactions are automatically committed. From the screenshot, we can see that there is a transaction in progress. Because set autocommit = 0; is set, the subsequent update operation will not modify the result, and other sessions will not be able to check it (RR level). At this time, you need to manually execute commit. Note that autocommit has not been changed. At this time, the autocommit value is still 0, which means that subsequent SQL statements of this session need to be committed manually. This is the end of this article about how to start a transaction in MySQL. For more information about starting a transaction in MySQL, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Vue implements nested routing method example
>>: Docker deployment MySQL8 cluster (one master and two slaves) implementation steps
This article uses examples to describe the common...
Passing values between mini program pages Good ...
1. Space rules Whitespace within HTML code is usu...
The warning points in this article have nothing t...
Basic network configuration Although Docker can &...
The ECS cloud server created by the historical Li...
In this blog, I will walk you through the process...
This article mainly discusses the differences bet...
In MySQL, you may encounter the problem of case s...
I encountered several problems when installing My...
Table of contents 1. Basic knowledge of indexing ...
1. What is event delegation? Event delegation: Ut...
Table of contents 1. About JavaScript 2. JavaScri...
1. Enter the Docker official website First, go to...
Linux online installation related commands: yum i...