Undo a wrong change
Undo a wrong DELETE, UPDATE or INSERT on specific rows. DBTrail writes the SQL; you review it and apply it.
Row-level undo: a handful of rows is wrong, you put those back. Whole tables or the whole database at a moment: Restore tables to a moment.

Three ways in


- Web interface → Restore. Filter by schema, table, key and time; preview before and after; copy or download the script. With a backup configured it also shows the row at that moment and its history. Hours rotated out with no archive are flagged; an incomplete undo is never shown as complete.
- Claude. The
recovertool, same filters. Setup: Connect Claude. - CLI.
bintrail recoveradds multiple keys, per-key limits, column matching and whole transactions by GTID. Reference. Runbooks:POST /api/recoverwith the access token.
# every change to orders 1000-1999 since 09:00, as a script to review
bintrail recover --index-dsn "$IDX" --schema shop --table orders \
--pk-min 1000 --pk-max 1999 --since "2026-09-14 09:00:00" --dry-runKey ranges (--pk-min, --pk-max, either alone): one integer key column
only. Composite, DECIMAL, string or binary keys, and PostgreSQL-sourced
indexes, are refused. Only plain decimal spelling matches (007 never does).
It scans the partitions your time filters keep, so pair it with --since and
--until.
A row at a moment
With a backup configured, Restore shows one row as it was at any instant, with its history above the undo form. Three possible answers: the row's state, deleted as of that time, or no baseline row for that PK. A gap between the backup and that instant is an error, never a wrong answer.
Foreign keys
- Undo runs newest first, so parents come back before their children, as long as every related delete is inside your filters.
- A parent deleted outside the window makes the
INSERTs fail on the foreign key. Widen the window or recover the parent first.
MySQL 8.x CASCADE limitation

Before MySQL 9.6, cascaded child changes are not in the binlog
The Events view and a plain undo cannot see them. Restore's cascade repair and
bintrail recover-cascade rebuild them from the foreign keys, for
ON DELETE CASCADE and ON DELETE SET NULL. + Add server warns about
CASCADE constraints with the ALTER TABLE to copy. When an undo holds a
delete or key update on a table with such children, the MCP recover tool
warns and points at recover_cascade, and a schema-wide undo in the web interface
warns and says to undo the parent table on its own. Workaround: ON DELETE RESTRICT and delete children explicitly.
MySQL 9.6 and later log cascades: see below.
MySQL 9.6 and later
MySQL 9.6 and later (9.7 is the supported version) write the child rows a
cascade deletes or changes to the binlog, unless the server starts with
innodb_native_foreign_keys = ON. Since 0.133.0, recover-cascade (the
command, the web interface and the MCP tool) undoes those logged child changes
together with the parent, so nothing has to be rebuilt from the foreign keys.
Older versions put back the parent alone on such a source.
DBTrail does not guess this from the version number. While it captures, it
reads innodb_native_foreign_keys from the source when it connects, once a
minute, and at every schema snapshot, and judges each parent change by the
readings around it. An index that spans an upgrade from 8.4 to 9.7 is right on
both sides of it. A change no reading covers (older than the first one, or in
the minute before a restart) is rebuilt from the foreign keys as before, and if
the index holds child changes from the same transaction, the result is marked
incomplete and names the first of them.
Before you apply
- Read the SQL. The data may have changed since the original event.
- Narrow the filters: table, key, time.
- Large batches: run in staging first.
- Roll back if unsure. The script is wrapped in
BEGIN/COMMIT.
Export to Iceberg
Hand your data to Spark, Trino, Athena or Snowflake as Apache Iceberg tables, without touching your database.
Restore Tables to a Moment
Rebuild whole tables as they were at any past second, as a .sql dump you load into MySQL. Point-in-time restore from a backup plus the recorded changes.