MySQL Transactions will automatically rollback if not committed

Just a quick note on this one, because although it seems obvious, I couldn’t find this explicitly mentioned anywhere in the MySQL manual entry for transaction syntax.

However if you issue an SQL ‘START TRANSACTION’ statement, anything you do after that will not affect the tables unless the ‘COMMIT’ statement is issued (assuming they are InnoDB tables). This is great because if your server crashed or you lost your connection to it, your data is protected.

Here’s an article from weberdev.com with more information: Using transactions in MySQL

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.