MySQL Transactions and ACID Properties Explained

ACID properties are what let you trust a database with money, inventory, or anything else where a half-completed operation would be a disaster. Transactions are how MySQL delivers on that promise.

START TRANSACTION;

UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;

-- If both succeeded, make it permanent
COMMIT;

-- If anything went wrong, undo everything
-- ROLLBACK;

What ACID Actually Guarantees

  • Atomicity — the whole transaction succeeds or none of it does; no partial money transfers.
  • Consistency — the database moves from one valid state to another, respecting all constraints.
  • Isolation — concurrent transactions don’t see each other’s uncommitted changes.
  • Durability — once committed, data survives a crash immediately after.

This only applies with the InnoDB storage engine — MyISAM doesn’t support transactions at all, which is one of the main reasons InnoDB is the modern default.