Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Transactions

MySQL supports transactions at the storage engine level. The most popular among the officially supported storage engines, InnoDB, provides transaction support. In this section, we discuss how to troubleshoot InnoDB transactions.

In MySQL, you can start a transaction using a START TRANSACTION or BEGIN statement. To commit a transaction, call COMMIT, and to roll it back (cancel it), call ROLLBACK.

An alternate way to start a multistatement transaction is to set the variable autocommit to zero. This will override the default MySQL behavior, which sends an implicit commit after each statement. With autocommit set to 0, you need to call COMMIT or ROLLBACK explicitly. After that, the next statement begins a new transaction automatically.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial