dbtrail

Quick Start

Get dbtrail streaming your MySQL changes — self-hosted with Docker Compose, or managed with dbtrail Cloud

dbtrail — the MySQL backup you can query, powered by binary logs

dbtrail is an open-source (Apache-2.0) change-tracking and point-in-time recovery system for MySQL. It tails the binary log and keeps every row-level change — with full before/after images — in a searchable index, so you can query your entire history, generate precise undo SQL, and time-travel any row to any moment. Full base snapshots (mydumper) plus continuous binlog streaming give you recovery down to the individual row. It works with MySQL and Percona Server 8.0 and 8.4, including Amazon RDS, Aurora, and Google Cloud SQL.

You can run dbtrail yourself from the open-source repository, or let dbtrail Cloud run it for you — same engine, managed control plane.

dbtrail Cloud

Using the managed service? The signup, server-registration, and provisioning flow lives in the Cloud Quick Start. The prerequisites below apply to both editions.

Claude is the recommended interface

The fastest way to use dbtrail is to ask Claude — natural language, no query syntax to learn. The web console, CLI, and API (and the dashboard, on dbtrail Cloud) are fully featured and work without Claude; Claude is optional, not required.


Prerequisites

Before connecting a server, make sure your MySQL instance is ready:

RequirementSQL checkExpected value
MySQL 8.0 or 8.4SELECT VERSION();8.0.x or 8.4.x
Binary logging enabledSHOW VARIABLES LIKE 'log_bin';ON
Row-based replicationSHOW VARIABLES LIKE 'binlog_format';ROW
Full row imagesSHOW VARIABLES LIKE 'binlog_row_image';FULL
InnoDB storage engineSee belowAll tracked tables use InnoDB
Primary key on every tableSee belowAll tracked tables have a primary key

Self-hosted dbtrail requires MySQL 8.0 or later; dbtrail Cloud additionally supports MySQL 5.7.

Run all three binlog checks at once

SHOW VARIABLES LIKE 'log_bin';           -- Must be ON
SHOW VARIABLES LIKE 'binlog_format';     -- Must be ROW
SHOW VARIABLES LIKE 'binlog_row_image';  -- Must be FULL

binlog_row_image must be FULL

This is the most commonly missed prerequisite. If binlog_row_image is set to MINIMAL or NOBLOB, dbtrail cannot capture complete before/after row data. Set it in your MySQL configuration:

[mysqld]
binlog_row_image = FULL

Self-hosted preflight: bintrail doctor

The bintrail doctor --source-dsn "user:pass@tcp(host:3306)/" command runs all of these checks and prints copy-pasteable remediation for anything that fails. The console's + Add server flow runs the same preflight automatically.

Create a dedicated MySQL user

Create a user with the minimum privileges dbtrail needs — replication access for binlog streaming and SELECT for schema snapshots:

CREATE USER 'bintrail'@'%' IDENTIFIED BY 'strong_password_here';
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'bintrail'@'%';
GRANT SELECT ON *.* TO 'bintrail'@'%';

On Amazon RDS and Aurora, grant the rds_replication role instead of REPLICATION SLAVE:

GRANT rds_replication TO 'bintrail'@'%';

Use a strong, unique password

Replace strong_password_here with a strong password. If your MySQL server is not accessible from the public internet, you can restrict the host part (e.g., 'bintrail'@'10.0.%') instead of using '%'.


Choose your edition

Open Source

Two commands stand up the full stack — the streaming daemon, a bundled index MySQL, and the web console:

curl -fsSLO https://raw.githubusercontent.com/dbtrail/dbtrail/main/docker-compose.yml
docker compose up -d

Open http://127.0.0.1:8090 — on first run the console asks you to create a username and password. Then click + Add server and paste the MySQL you want to watch (host, port, and the dedicated user you created above). dbtrail runs the preflight checks, provisions an index for the server, and starts streaming — you'll see events within the minute.

The compose stack bundles a MySQL 8.4 container as the index store; that index holds your forensic record, so back up its volumes. For binary installs, bringing your own index MySQL, baselines for time-travel, and production deployment, see the dbtrail repository.

dbtrail Cloud

dbtrail Cloud runs the same engine as a managed service: register your server and dbtrail provisions and operates the infrastructure — fully hosted, or with the agent inside your VPC so your data never leaves your network. Self-serve signup is closed; existing Cloud customers can follow the Cloud Quick Start.


Verify it works

Make a test change to confirm dbtrail is capturing events:

CREATE DATABASE IF NOT EXISTS dbtrail_test;
CREATE TABLE IF NOT EXISTS dbtrail_test.ping (
  id INT PRIMARY KEY,
  ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO dbtrail_test.ping (id) VALUES (1);

Wait 30 seconds for the change to be indexed, then verify:

Open the console at http://127.0.0.1:8090 — the INSERT appears in the recent-changes list on the Overview, and the Events screen lets you filter by schema and table.

Running the binaries directly instead of the compose stack? The CLI does the same from the terminal:

bintrail query --index-dsn "$IDX" --schema dbtrail_test --table ping

Go to Dashboard → Query, filter by schema and table, and you should see your INSERT events.

dbtrail Query Explorer showing recent INSERT events with schema, table, event type, and primary key columns

Or hit the REST API with an API key:

curl -s https://api.dbtrail.com/api/v1/query \
  -H "Authorization: Bearer bt_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"server": "production-main", "schema": "dbtrail_test", "limit": 5}'

Clean up the test table when you're done:

DROP DATABASE dbtrail_test;

No changes appearing?

If nothing shows up after 60 seconds, check that the stream is running — the console's Status view (Open Source) or Dashboard → Servers → your server → Status (dbtrail Cloud) — and that the MySQL user has SELECT and REPLICATION privileges. See Troubleshooting for common issues.


Connect Claude

Both editions expose your change history to Claude (or any MCP client) through the same three read-only tools: query, recover (always dry-run — the AI never executes SQL), and status.

  • Open Source — run the bundled bintrail-mcp server alongside your index, or self-host the MCP gateway for remote clients.
  • dbtrail Cloud — connect to the hosted endpoint https://api.dbtrail.com/mcp with a bt_live_ API key; included on all plans, including Free.

See Connect Claude for setup in Claude Code, claude.ai, Claude Desktop, and Cursor.

Once connected, ask Claude anything about your database changes:

"Show me recent changes in dbtrail_test"

Claude querying dbtrail via MCP — showing recent changes with event counts and table breakdown

Next steps

On this page