In Windows when we installed MySQL:
1. The concept of a transaction
A transaction is a set of SQL statement operations, and the individual SQL statements that make up this set of operations must all succeed in order to result. Any SQL statement execution fails and the end result will not actually execute.
2. Transaction and Storage Engine
The storage engine of the table must be innodb;
3. Transaction processing1) Open transaction
Start transaction; | Begin
Modify the default SQL statement terminator
Because there are many SQL statements in the transaction, by default, the statement terminator for MySQL is ";" So the default terminator to modify, modify the method: Delimiter statement Terminator
Statement Terminator can be customized, "$$", $$$,%%%,////,//, ....
For example, modify the default statement terminator to//
Delimiter//
2) Commit the transaction
1 Commit
3) Rolling back transactions
1 rollback;
1. Characteristics of transactions (ACID) 1) atomicity (atomicity): A transaction consists of one or a set of interrelated SQL statements that are considered an indivisible unit. 2) Consistency (consistency): Transactional consistency means that the database must be in a consistent state before and after a transaction is executed. This feature is known as transactional consistency 3) Isolation (Isolation): Each transaction has its own space, the execution of a transaction is not disturbed by other transactions 4) persistence (durability): Changes to the data after committing the transaction are updated Permanent.
mysql--transactions