Menu

1 / 2

`mysqldump --single-transaction` and Consistent Backups: "It Finished" Is Not "It Restores"

DEV Community: tutorial·Susumu Takahashi·about 1 hour ago
#jPhvd7q4
#devtotutorial#devto#dev#tables#dump
Reading 0:00
15s threshold

The 3-2-1 rule tells you where to keep backups. It says nothing about whether the contents are correct .

mysqldump is a common way to back up a database. But if you dump a database that is still being written to, the file can finish without any error and still restore into data that disagrees across tables . This article reproduces that on a local MySQL and explains what --single-transaction is for. It is a general explanation, not a description of any specific product.

Note: The experiment ran on October 17, 2026 on a local MySQL 9.6 (InnoDB). Counts vary with environment and timing, so read the numbers as one observed example.

What "consistent" means

Many WordPress tables depend on each other: posts and post meta, orders and order items. A row on one side is meaningless without its counterpart.

A consistent backup is a snapshot of the whole database at one point in time . All tables must be in the state they had at the same moment.

The catch is that mysqldump writes tables one after another .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.