mysql - Transaction

Mysql main feature is the storage engine. . .

Show Supported storage engine with SHOW ENGINES

 

 The default is innoDB

MyISAM is the default storage engine a long time ago

memory is also more common

Only three innoDB support transactions.

 

Services: atomicity, consistency, isolation, durability

 

1. implicit transaction:

Under normal circumstances, each time you run a sql statement can be seen as a transaction

To see if auto-commit

SHOW VARIABLES LIKE 'autocommit'

Usually the default is on

No start and end tags.

 

2. explicit transaction

There are obvious beginning and end

The SET autocommit =  0 ; # turn off auto-submit 
the START TRANSACTION ; # open transaction 
# statement
COMMIT ; # commit the transaction, the statement take effect ROLLBACK ; # rollback statement does not take effect

 

 

Guess you like

Origin www.cnblogs.com/clamp7724/p/11791226.html