{"id":51578798,"url":"https://github.com/wolfsoftwaresystemsltd/sqlrestore","last_synced_at":"2026-07-11T03:32:26.445Z","repository":{"id":351816236,"uuid":"1212614222","full_name":"wolfsoftwaresystemsltd/sqlrestore","owner":"wolfsoftwaresystemsltd","description":"Fast MariaDB / MySQL dump restore with per-table exclusion","archived":false,"fork":false,"pushed_at":"2026-05-15T04:31:57.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-15T06:41:44.736Z","etag":null,"topics":["backup","cli","command-line","database","database-tools","dba","devops","mariadb","mysql","mysqldump","restore","rust","sql","static-binary","sysadmin"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wolfsoftwaresystemsltd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"wolfsoftwaresystemsltd"}},"created_at":"2026-04-16T14:54:42.000Z","updated_at":"2026-05-15T04:32:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wolfsoftwaresystemsltd/sqlrestore","commit_stats":null,"previous_names":["wolfsoftwaresystemsltd/sqlrestore"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wolfsoftwaresystemsltd/sqlrestore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfsoftwaresystemsltd%2Fsqlrestore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfsoftwaresystemsltd%2Fsqlrestore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfsoftwaresystemsltd%2Fsqlrestore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfsoftwaresystemsltd%2Fsqlrestore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wolfsoftwaresystemsltd","download_url":"https://codeload.github.com/wolfsoftwaresystemsltd/sqlrestore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfsoftwaresystemsltd%2Fsqlrestore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35350133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","cli","command-line","database","database-tools","dba","devops","mariadb","mysql","mysqldump","restore","rust","sql","static-binary","sysadmin"],"created_at":"2026-07-11T03:32:26.242Z","updated_at":"2026-07-11T03:32:26.436Z","avatar_url":"https://github.com/wolfsoftwaresystemsltd.png","language":"Rust","funding_links":["https://github.com/sponsors/wolfsoftwaresystemsltd"],"categories":[],"sub_categories":[],"readme":"# sqlrestore\n\n[![CI](https://github.com/wolfsoftwaresystemsltd/sqlrestore/actions/workflows/ci.yml/badge.svg)](https://github.com/wolfsoftwaresystemsltd/sqlrestore/actions/workflows/ci.yml)\n[![Release](https://img.shields.io/github/v/release/wolfsoftwaresystemsltd/sqlrestore?logo=github)](https://github.com/wolfsoftwaresystemsltd/sqlrestore/releases/latest)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n[![Sponsor](https://img.shields.io/badge/Sponsor-Wolf%20Software%20Systems-ea4aaa?logo=githubsponsors\u0026logoColor=white)](https://github.com/sponsors/wolfsoftwaresystemsltd)\n\nFast MariaDB / MySQL dump restore with **per-table exclusion**.\n\n`sqlrestore` streams a `mysqldump`-format `.sql` (or `.sql.gz`) file straight\ninto the `mariadb` client, skipping the structure and data of any tables you\nname on the command line. It never loads the dump into memory, so it works on\ndumps of arbitrary size.\n\nTypical use case: you have a 200 GB nightly dump that includes a giant\n`assets` / `assetcache` table you don't actually want on this machine. Restore\neverything else in one pass without unpacking, editing, or pre-processing the\ndump.\n\n---\n\n## Sponsor\n\nIf `sqlrestore` saves you time, please consider sponsoring our work — it\nfunds the open-source tools we publish.\n\n\u003cp\u003e\n  \u003ca href=\"https://github.com/sponsors/wolfsoftwaresystemsltd\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/%E2%9D%A4%20Sponsor-Wolf%20Software%20Systems-ea4aaa?style=for-the-badge\u0026logo=githubsponsors\u0026logoColor=white\" alt=\"Sponsor on GitHub\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n- Streams the dump line-by-line — handles dumps far larger than RAM.\n- Filters whole table sections (DROP, CREATE, LOCK, INSERT, UNLOCK) by parsing\n  the `mysqldump` section markers — no SQL re-parsing required.\n- Transparent `.gz` decompression (multi-member safe).\n- Pipes filtered SQL into the `mariadb` (or `mysql`) client over a 1 MiB\n  buffered pipe.\n- Wraps the session in `AUTOCOMMIT=0`, `UNIQUE_CHECKS=0`,\n  `FOREIGN_KEY_CHECKS=0`, `SQL_NOTES=0` and a single trailing `COMMIT` for\n  significantly faster InnoDB restores.\n- Password is passed via the `MYSQL_PWD` environment variable, never on the\n  command line.\n- `--dry-run` mode prints the filtered SQL to stdout for inspection.\n- Single static binary — no runtime dependencies, runs on any Linux distro.\n\n## Install\n\n### One-liner (recommended)\n\nStatically-linked binaries for `x86_64` and `aarch64` are published with every\nrelease, so you don't need a Rust toolchain to install:\n\n```sh\ncurl -fsSL https://raw.githubusercontent.com/wolfsoftwaresystemsltd/sqlrestore/main/setup.sh | bash\n```\n\nPin a version or change the install prefix:\n\n```sh\ncurl -fsSL https://raw.githubusercontent.com/wolfsoftwaresystemsltd/sqlrestore/main/setup.sh \\\n    | VERSION=v0.1.0 PREFIX=$HOME/.local bash\n```\n\n### Manual download\n\nGrab the right tarball for your CPU from the\n[releases page](https://github.com/wolfsoftwaresystemsltd/sqlrestore/releases/latest):\n\n| Platform                   | Asset                                    |\n| -------------------------- | ---------------------------------------- |\n| Linux x86_64 (Intel/AMD)   | `sqlrestore-\u003cver\u003e-linux-x86_64.tar.gz`   |\n| Linux aarch64 (ARM64)      | `sqlrestore-\u003cver\u003e-linux-aarch64.tar.gz`  |\n\n```sh\ntar -xzf sqlrestore-*-linux-x86_64.tar.gz\nsudo install -m 0755 sqlrestore /usr/local/bin/\n```\n\nEach tarball ships with a matching `.sha256` sidecar.\n\n### Build from source\n\nRequires Rust 1.74+ and the `mariadb` (or `mysql`) client binary on `PATH`.\n\n```sh\ngit clone https://github.com/wolfsoftwaresystemsltd/sqlrestore.git\ncd sqlrestore\ncargo build --release\n# binary at ./target/release/sqlrestore\n```\n\n## Usage\n\n```\nsqlrestore \u003cuser\u003e \u003cpassword\u003e \u003cdatabase\u003e \u003cfile\u003e [options]\n```\n\n| Argument          | Description                                          |\n| ----------------- | ---------------------------------------------------- |\n| `\u003cuser\u003e`          | Database user                                        |\n| `\u003cpassword\u003e`      | Database password (use `\"\"` for none)                |\n| `\u003cdatabase\u003e`      | Target database name (must already exist)            |\n| `\u003cfile\u003e`          | Path to dump file (`.sql` or `.sql.gz`)              |\n\n| Option                  | Default     | Description                                   |\n| ----------------------- | ----------- | --------------------------------------------- |\n| `--exclude a,b,c`       | (none)      | Comma-separated list of tables to skip        |\n| `-H, --host`            | `localhost` | Database host                                 |\n| `-P, --port`            | `3306`      | Database port                                 |\n| `--client`              | `mariadb`   | Client binary (e.g. `mysql`)                  |\n| `--client-arg a,b`      | (none)      | Extra args passed through to the client       |\n| `--dry-run`             | off         | Print filtered SQL to stdout instead          |\n| `--no-tune`             | off         | Skip the speed-tuning `SET` wrapper           |\n| `--progress-mib N`      | `256`       | Print progress every N MiB read (`0` to off)  |\n\n## Examples\n\nRestore a dump into `mydb`, skipping two large tables:\n\n```sh\nsqlrestore root '' mydb backup.sql --exclude assets,assetcache\n```\n\nRestore from a gzipped dump on a remote MariaDB:\n\n```sh\nsqlrestore admin 'p@ss' prod_clone backup.sql.gz \\\n    --exclude audit_log,sessions \\\n    -H db.internal -P 3306\n```\n\nInspect what would be restored without touching the database:\n\n```sh\nsqlrestore u p mydb backup.sql --exclude assets --dry-run | less\n```\n\nUse the `mysql` client instead of `mariadb`, with extra client flags:\n\n```sh\nsqlrestore root '' mydb backup.sql \\\n    --client mysql \\\n    --client-arg --ssl-mode=DISABLED,--local-infile=1\n```\n\n## How the table filter works\n\n`mysqldump` always emits section markers like:\n\n```\n--\n-- Table structure for table `users`\n--\n...\n--\n-- Dumping data for table `users`\n--\n...\n```\n\n`sqlrestore` watches for these markers (also the `Temporary table structure\nfor view` and `Final view structure for view` variants). When a marker names\nan excluded table, every following line is dropped until the next section\nmarker. That cleanly removes the table's `DROP`, `CREATE`, `LOCK TABLES`,\n`INSERT`, `UNLOCK TABLES`, and trigger statements as a single unit, without\nhaving to tokenize SQL.\n\nTable name matching is case-insensitive.\n\n## Caveats\n\n- The target database must already exist; `sqlrestore` does not run `CREATE\n  DATABASE`.\n- Foreign key constraints from kept tables that reference excluded tables\n  will fail at `CREATE TABLE` time. Either also exclude the dependent table or\n  drop the foreign key from the source schema.\n- `sqlrestore` only understands dumps produced by `mysqldump`/`mariadb-dump`.\n  Hand-crafted SQL files without the standard section markers are passed\n  through unchanged.\n\n## Releases \u0026 CI\n\nPushes to `main` and pull requests are validated by the\n[CI workflow](.github/workflows/ci.yml) (rustfmt, clippy, build, test on both\nglibc and musl).\n\nTagging `vX.Y.Z` triggers the\n[release workflow](.github/workflows/release.yml), which cross-builds static\nbinaries for `x86_64-unknown-linux-musl` and `aarch64-unknown-linux-musl` and\nattaches them — with SHA-256 sidecars — to the GitHub release.\n\n## Contributors\n\n- [Wolf Software Systems Ltd](https://github.com/wolfsoftwaresystemsltd) — maintainer\n- Fang the AI — implementation \u0026 docs\n\nContributions welcome — please open an issue or PR.\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfsoftwaresystemsltd%2Fsqlrestore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwolfsoftwaresystemsltd%2Fsqlrestore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfsoftwaresystemsltd%2Fsqlrestore/lists"}