How MySQL and MariaDB backups work
Physical backups, continuous binary log shipping, encryption, and what Rowsafe needs on your server.
For MySQL and MariaDB, the agent streams physical backups and the binary log straight from your server to your bucket, encrypted on the way. Nothing passes through Rowsafe's service.
Backups
Percona XtraBackup (8.0 for MySQL 8.0, 8.4 for MySQL 8.4) or mariadb-backup copies the data files while the server runs. InnoDB tables aren't locked; MyISAM and Aria tables are locked only while copied.
The stream (--stream=xbstream) is compressed (zstd), encrypted and uploaded in parts. Nothing is written to your disk on the way.
| Type | What it copies | When |
|---|---|---|
| Full | everything | weekly, and the first backup |
| Differential | pages changed since the last full | daily |
| Incremental | pages changed since the last backup | on request (rowsafe backup --type incr) |
A restore needs one full plus the backups built on it. Rowsafe keeps the retention's number of fulls (2 by default) and deletes older ones with the binary logs only they needed.
The binary log, shipped continuously
The binary log records every change. The agent uploads what's new:
- a finished file, right away;
- the current file once 16 MiB are waiting, or the oldest waiting change is 50 seconds old.
So your bucket is at most about a minute behind, without forcing file switches. A Mark uploads at once and counts only once in the bucket. "Last change saved" in the dashboard is the time up to which everything is in your bucket.
If the agent or bucket is unreachable for a while, it catches up, as long as the server still has the files (keep them at least a day; MySQL keeps 30 days by default). If files were deleted before upload, Rowsafe says so and the next full backup closes the gap.
Restoring to a second
A restore (Proof, a Rewind copy) downloads and unpacks the backup chain, prepares it, and starts a private server: your server's own binary, on a Unix socket only the agent can reach, without grant tables, binary log, replication or scheduled events. It then replays the binary logs up to the second you chose (including the whole transaction committed at that second), or exactly to a Mark.
Encryption
Every object is compressed, then encrypted on your server with age, keyed from your repository passphrase (ROWSAFE_REPO_CIPHER_PASS) through scrypt. The bucket only holds ciphertext; the passphrase never leaves your server. Without it, nothing can be restored.
In your bucket
<path prefix>/<mysql|mariadb>/<database name>/
repository.json.age the database's marker
backups/<label>/data.xbs.zst.age a backup (the xbstream stream)
backups/<label>/manifest.json.age written last: the backup is complete
binlogs/<file>~<created>/<from>-<to>.zst.age binary log bytes, by position
marks/<name>.json.age Marks: binary log position and timeLabels follow pgBackRest's (20260925-020000F, 20260925-020000F_20260926-020000D). Object names hold none of your data.
The settings Rowsafe needs
| Setting | Needed | MySQL 8 default | MariaDB default | Needs a restart |
|---|---|---|---|---|
log_bin | on | on | off | Yes |
binlog_format | ROW | ROW | MIXED | No |
binlog_row_image | FULL | FULL | FULL | No |
Nothing changes until you approve the plan. Rowsafe writes them to /etc/rowsafe/mysql/server.cnf (included from /etc/mysql/conf.d/zz-rowsafe.cnf, empty until you turn on backups) and sets what it can live. In Docker, the plan lists options to add to your service's command.
Recommended but not changed: sync_binlog = 1. GTIDs aren't needed (restores use positions), and turning them on is your call.
Rowsafe's account
The agent logs in as rowsafe@localhost, created once by root over the socket or with an admin password you give once (in Docker, the root password file). Its random password stays on your server, readable by the agent only.
| Privileges | For |
|---|---|
RELOAD, LOCK TABLES, PROCESS, BACKUP_ADMIN (MySQL) | consistent backups |
REPLICATION CLIENT (MySQL) / BINLOG MONITOR (MariaDB) | the binary log position of a backup or a Mark |
SELECT, SHOW VIEW, TRIGGER | comparing a copy with production, monitoring |
INSERT, UPDATE | bringing rows back, only when someone asks in the dashboard |
INDEX | creating and dropping the indexes someone picks |
CONNECTION_ADMIN (MySQL) / CONNECTION ADMIN (MariaDB) | ending a query or session, only when someone applies that fix |
CREATE USER and the database rights (CREATE, DROP, ALTER, DELETE...) WITH GRANT OPTION | Databases & users, only when someone asks. The server's own accounts (root, mysql.*) are never changed. |
SYSTEM_VARIABLES_ADMIN, PERSIST_RO_VARIABLES_ADMIN (MySQL) / SUPER (MariaDB) | Tuning and turning on the slow query log, only when someone asks |
If you allowed standby servers at install (--mysql-standby), it also gets ALL PRIVILEGES WITH GRANT OPTION, used only to add, promote or remove a standby, fork to an empty server or move a database in.
On your server
| Path | What |
|---|---|
/var/lib/rowsafe/engines/<mysql|mariadb>/ | Rowsafe's account, binary log shipping state, Rewind copies' records |
/var/lib/rowsafe/drills/ | Proof's scratch copies, deleted when the test ends |
/var/lib/rowsafe/rewind/ | Rewind copies, deleted when they expire |
/etc/rowsafe/mysql/server.cnf | the binary log settings Rowsafe asked for |
On Ubuntu, the installer lets AppArmor-confined mysqld use these folders.