
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How MySQL manage the behavior of a transaction?
MySQL can manage the behavior of a transaction with the help of the following two modes −
Autocommit On
It is the default mode. In this mode, each MySQL statement (within a transaction or not) is considered as a complete transaction and committed by default when it finishes. It can be started by setting the session variable AUTOCOMMIT to 1 as follows −
SET AUTOCOMMIT = 1 mysql> SET AUTOCOMMIT = 1; Query OK, 0 rows affected (0.07 sec)
Autocommit Off
It is not the default mode. In this mode, the subsequent series of MySQL statements act like a transaction, and no activities are committed until an explicit COMMIT statement is issued. It can be started by setting the session variable AUTOCOMMIT to 0 as follows −
SET AUTOCOMMIT = 0 mysql> SET AUTOCOMMIT = 0; Query OK, 0 rows affected (0.00 sec)
- Related Articles
- How can we implement a MySQL transaction?
- How can a user start new MySQL transaction?
- What will happen to the current MySQL transaction if a START TRANSACTION command is executed in the middle of that current transaction?
- What happens to the current MySQL transaction if the session is ended in the middle of a transaction?
- How can a user explicitly end current MySQL transaction?
- How can a user implicitly end current MySQL transaction?
- How can we check the current MySQL transaction isolation level?
- How can we find out the current transaction mode in MySQL?
- What will happen to MySQL current transaction, if in the middle of that transaction, the DDL statement is executed?
- How can I manage the start position of searching in MySQL LOCATE() function?
- mysqld_multi - Manage Multiple MySQL Servers
- What happens when we use COMMIT in MySQL stored procedure and one of the transaction, under START transaction, fails?
- What is transaction processing? Explain the properties of the transaction(DBMS)
- How do Transaction Costs affect the Dividend Policy of a company?
- How changes, made in the current transaction, can be permanently recorded\nin MySQL database?

Advertisements