【知识库】--mysqlCOMMIT and ROLLBACK --AUTOCOMMIT(196)

xiaoxiao2021-02-28  103

COMMIT and ROLLBACK: These two keywords Commit and Rollback are mainly used for MySQL Transactions.

When a successful transaction is completed, the COMMIT command should be issued so that the changes to all involved tables will take effect.

If a failure occurs, a ROLLBACK command should be issued to return every table referenced in the transaction to its previous state.

You can control the behavior of a transaction by setting session variable called AUTOCOMMIT. If AUTOCOMMIT is set to 1 (the default), then each SQL statement (within a transaction or not) is considered a complete transaction and committed by default when it finishes. When AUTOCOMMIT is set to 0, by issuing the SET AUTOCOMMIT=0 command, the subsequent series of statements acts like a transaction and no activities are committed until an explicit COMMIT statement is issued.

转载请注明原文地址: https://www.6miu.com/read-75182.html

最新回复(0)