Back up and restore local databases

On this page

Short Leash's backups are daily copies of each MySQL, MariaDB, PostgreSQL and MongoDB database on your computer, kept for a number of days, that you can restore one database at a time.

Back up now works on the free core, even for a database whose service needs Short Leash Pro: Short Leash starts it just long enough to export it. Scheduled backups are part of Short Leash Pro.

How do I turn them on?

Open Machine › Backups and turn on Back up databases every day at. Pick a time; 03:00 is the default. Keep sets how many days of backups to keep, from 1 to 365; the default is 7.

To back up straight away, choose Back up now. It backs up every running database service, except the databases you skip. From a database's row you can back up just that database.

How do I leave a database out?

Not every database is worth a backup. Open the … menu on a database's row and choose Skip daily backups. The row then says Skipped in daily backups, and neither the daily run nor Back up now at the top touches it. Its existing backups stay until cleanup removes them like any other.

Choose Back up now in that database's own menu and it's backed up anyway, so you can still take a copy before a risky change. To put it back, open the menu and choose Include in daily backups.

What happens if my computer is asleep at backup time?

Short Leash checks every minute whether a backup is due. If your Mac was asleep or Short Leash wasn't running, the backup runs as soon as it can.

A service that's off isn't started for a backup. Its group on the screen says Off: backs up the next time it runs, and Short Leash backs it up once you start it.

Where are backups kept?

In ~/Library/Application Support/Short Leash/backups (%LOCALAPPDATA%\Short Leash\backups on Windows), one folder per service and database:

backups/mysql/shop/2026-10-11_070000-scheduled.sql.gz
backups/mariadb/wiki/2026-10-11_070000-scheduled.mariadb.sql.gz
backups/postgres/blog/2026-10-11_070000-manual.dump
backups/mongodb/catalog/2026-10-11_070000-scheduled.archive.gz

The time in a file's name is UTC; the screen shows your local time. Choose Change next to Folder to use another folder, such as one a backup or sync app copies. Only your account can open the folders Short Leash makes and the backups in them.

Backups hold your data. Anyone who can read the folder can read the databases.

What's in a backup?

One file per database, made with the database's own tools from Short Leash's install:

  • MySQL: mysqldump with stored routines, triggers and events, gzipped (.sql.gz). It reads one consistent snapshot, so apps can keep running.
  • MariaDB: mariadb-dump, MariaDB's own, with the same options, gzipped (.mariadb.sql.gz).
  • PostgreSQL: pg_dump's custom format (.dump), which is already compressed.
  • MongoDB: mongodump --archive --gzip (.archive.gz), restored with mongorestore; both from MongoDB's Database Tools in Short Leash's install.

A backup restores into the kind of server that made it: a MariaDB backup into MariaDB, a MySQL backup into MySQL, a MongoDB backup into MongoDB. A backup or restore that runs past 6 hours, such as a dump waiting on a lock that's never released, is stopped and says so.

Short Leash makes a backup at the daily time when that's on, when you choose Back up now, before a restore replaces a database (Before restore), before leash db drop drops one (Before drop), and before removing a branch workspace drops the database it was made with (Before remove). A backup taken before a drop is the dropped database's newest, so the daily clean-up always keeps it.

They open in other tools too: gunzip -c file.sql.gz | mysql shop, gunzip -c file.mariadb.sql.gz | mariadb shop, pg_restore -d shop file.dump, or mongorestore --gzip --archive=file.archive.gz. Valkey, Redis, Memcached, Meilisearch, Typesense and RustFS aren't backed up: they hold caches, search indexes and files rather than your app's data. See 0021 for why backups are dumps rather than copies of the data folder, and 0077 for MariaDB's and MongoDB's own backup tools.

How do I find a backup?

Above the list, Filter databases matches database names as you type. The buttons next to it narrow the list to one service, to backups taken for one reason (Scheduled, Manual, Before restore, Imported, Before drop or Before remove), or to databases whose last backup failed (Failed only). The line beside them says how many databases are shown, and Clear filters shows them all again. Filters only change what's shown; the totals under the settings count every backup.

How long are backups kept?

After each daily run, Short Leash deletes backups older than the Keep setting, for MySQL, MariaDB, PostgreSQL and MongoDB alike. A database's newest backup is always kept, however old, so a database you've stopped using doesn't lose its last copy. Choose Delete on a backup to remove it yourself.

A dump you bring in when you import a database from another tool is copied here first and listed as Imported. It's kept and deleted like every other backup.

How do I restore a database?

Expand the database's row, then choose Restore on the backup you want. Then pick one:

  • Replace shop: Short Leash backs up the database as it is now first (listed as Before restore), then replaces it with the backup. If you picked the wrong backup, restore the Before restore one.
  • Restore into a new database: Short Leash makes a new database, shop_restored unless you name it, and leaves the original alone. The name must not be taken. MongoDB names can't contain ., $ or spaces, or differ only in case from a database that's there; its collections are restored into the new database.

When Short Leash drops a database, it backs it up first, listed as Before drop (or Before remove for a branch workspace's database), and the database stays in the list with that backup. Restore it the same way to get it back. If that backup fails, the database isn't dropped.

Stop apps and workers that use the database before you replace it. For PostgreSQL, Short Leash closes the database's open connections first; MongoDB's database is dropped whole, then restored, and the restore fails, saying how many, if any document doesn't go back in. The service must be running to restore.

Before a MySQL or MariaDB restore, Short Leash reads the whole backup. It won't restore one that holds a mysql or mariadb client command or a statement that switches to another database, and says which line it found. Nothing is dropped or changed when that happens. A backslash command (such as \T or \!) is refused anywhere outside quotes and comments. The name of a command (such as tee, source or status) is refused wherever the client might run it: first on a line, right after a comment, or right after the ;, even when it's part of your SQL. To keep such a line, take out the line break or comment in front of the word, or put a name in backticks. A -- with no space after it at the start of a statement is refused too, because MariaDB's client skips the rest of that line and MySQL's doesn't; add the space. A dump that names more than 10,000 different user variables is also refused.

Can I use it from the terminal?

Terminal window
leash backup list
leash backup now
leash backup now mysql shop
leash backup skip postgres analytics
leash backup include postgres analytics
leash backup restore mysql/shop/2026-10-11_070000-scheduled.sql.gz
leash backup restore mysql/shop/2026-10-11_070000-scheduled.sql.gz --into shop_copy

leash backup list marks skipped databases. AI tools connected through leash mcp can list backups with list_backups. See the CLI reference.