Molniya is a Rust-based CLI tool for restoring MySQL database backups with support for:
- Zipped or folder contains
.sql.gzbackups - Table exclusion presets
- Dry-run mode for safe preview
- Safety confirmation via
--yes - Preset management (
add,edit,list,remove)
It is designed for database administrators, developers, and automation scripts.
- Rust >= 1.70
- MySQL server or compatible (MariaDB, etc)
- .sql.gz backups
Download the binary from release
chmod +x molniya
sudo install -m 755 molniya /usr/local/bin/molniyagit clone https://github.com/sqyo17/molniya.git
cd molniya
cargo build --release
sudo install -m 755 target/release/molniya /usr/local/bin/molniyaVerify
molniya --version
Molniya uses environment variables to connect to MySQL:
| Variable | Default | Description |
|---|---|---|
MYSQL_USER |
root | MySQL username (required) |
MYSQL_PASSWORD |
null | MySQL password |
MYSQL_HOST |
127.0.0.1 | MySQL host |
MYSQL_PORT |
3306 | MySQL port |
You can set them in a .env file in the project folder:
MYSQL_USER=root
MYSQL_PASSWORD=
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306Molniya has two main commands: restore and preset.
molniya <COMMAND> [OPTIONS]
Restore a MySQL database from a backup folder:
molniya restore <BACKUP_FOLDER or ZIP_FILE> --db <DB_NAME>
[--preset <PRESET>] [--dry-run] [--yes]
Option
| Option | Description |
|---|---|
| db | Name of the database to restore |
| preset | Use a preset to exclude tables |
| dry-run | Show what would be restored without changing DB |
| yes | Skip confirmation prompt |
Presets allow you to define tables to exclude during restore:
molniya preset add <NAME>
molniya preset edit <NAME>
molniya preset list
molniya preset remove <NAME>
add: interactively create a new presetedit: edit an existing presetlist: show all presetsremove: delete a preset
--dry-run– preview restore without executing SQL--yes– confirm restore automatically (non-interactive)-h, --help– show help
molniya restore path/to/folder/of/sql.qz --db mydb
molniya restore path/to/folder/of/sql.qz --db mydb --preset mypreset
molniya restore path/to/folder/of/sql.qz --db mydb --preset mypreset --dry-run
molniya restore path/to/folder/of/sql.qz --db mydb --preset mypreset --yes
molniya preset add mypreset
molniya preset list
molniya preset edit mypreset
molniya preset remove mypreset