Business ： An important means to ensure data consistency
Baidu said ： Business （Transaction）, Generally speaking, it refers to the things to be done or done . Transaction by The transaction start (begin transaction) And end of business (end transaction) All operations performed between .
A transaction operation is a phase operation , It's a process , Not a node
start transaction Identifies the start of the transaction ,commit Commit transaction , Writes the execution results to the database . If sql There is a problem with statement execution , Would call rollback, Rollback all that have been executed successfully sql sentence . Of course , It can also be used directly in transactions rollback sentence Roll back .
autocommit Parameters are for connections , The parameters were changed in a connection , No other connections will be affected .
in other words , you cmd after Input mysql -uroot -pxxxx Every black window after login belongs to a person connection .
- Atomicity （Atomicity, Or indivisibility ）
- Uniformity （Consistency）
- Isolation, （Isolation）
- persistence （Durability）
Oracle The default transaction isolation level is READ COMMITTED( Read submitted ) RC, mysql The default isolation level is RR Repeatable Read ( Repeatable )
mysql Of redo log
Dirty reading , It can't be read repeatedly , Fantasy reading
Dirty reading ： Current affairs (A) Can read about other transactions (B) Uncommitted data （ Dirty data ） , This phenomenon is dirty reading .
create table bank_money (id int auto_increment primary key,name varchar(16),money int);
insert into bank_money (id,name,money) values (null,"liuyuanyuan",200);
In the beginning, I had a bank card account 200 Yuan