{"id":22702508,"url":"https://github.com/vielhuber/syncdb","last_synced_at":"2025-08-07T09:32:21.604Z","repository":{"id":57077907,"uuid":"61494672","full_name":"vielhuber/syncdb","owner":"vielhuber","description":"🔥 Sync databases between two servers. 🔥","archived":false,"fork":false,"pushed_at":"2023-08-24T09:42:22.000Z","size":253,"stargazers_count":7,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-02T21:22:41.830Z","etag":null,"topics":["database","mysql","sql","sync-database"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vielhuber.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2016-06-19T18:40:24.000Z","updated_at":"2024-04-23T14:18:03.585Z","dependencies_parsed_at":"2024-04-23T14:17:59.390Z","dependency_job_id":"e6f7607f-f81e-435c-b691-28e44ad016bb","html_url":"https://github.com/vielhuber/syncdb","commit_stats":{"total_commits":103,"total_committers":1,"mean_commits":103.0,"dds":0.0,"last_synced_commit":"44d541e998144dfbf2b2090530ed1cd2a7841df0"},"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vielhuber%2Fsyncdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vielhuber%2Fsyncdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vielhuber%2Fsyncdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vielhuber%2Fsyncdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vielhuber","download_url":"https://codeload.github.com/vielhuber/syncdb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229019413,"owners_count":18007169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["database","mysql","sql","sync-database"],"created_at":"2024-12-10T07:13:45.577Z","updated_at":"2024-12-10T07:13:46.223Z","avatar_url":"https://github.com/vielhuber.png","language":"PHP","readme":"# 🔥 syncdb 🔥\n\nsyncdb syncs databases between two servers.\n\n## Features\n\n-   Most common use case: Sync your production database to your local environment\n-   You also can sync between any servers, even from remote to remote (without local)\n-   Works with direct database connections or via ssh tunnels\n-   Currently supports mysql, postgresql support will be added soon\n-   Has also a fast mode where the sql file is zipped (you also can choose the compression level)\n-   Does include a search/replace mechanism called [magicreplace](https://github.com/vielhuber/magicreplace)\n-   (Remote) commands like mysqldump, mysql, zip, e.g. can be overwritten manually to fit any environment\n-   Works on Linux, Mac and Windows (with WSL)\n-   Supports parallel execution of multiple syncs\n-   Uses optimization techniques for a faster restore\n-   Also supports ssh connections to servers without the support for public keys\n-   Shows live restore progress\n\n## Requirements\n\n#### Mac\n\nInstall [Homebrew](https://brew.sh) and then [coreutils](https://formulae.brew.sh/formula/coreutils):\n\n```\nbrew install coreutils\n```\n\n#### Windows\n\nChoose one of the two following options:\n\n-   Install [WSL2](https://docs.microsoft.com/de-de/windows/wsl/install-win10)\n-   Install [Cygwin](https://cygwin.com/install.html):\n    -   Install all default packages + `unzip`\n    -   Add `C:\\cygwin64\\bin` to your environment PATH (high priority, but below php)\n\n## Installation\n\n### Mac / Windows (WSL2) / Linux\n\n```bash\nmkdir ~/.syncdb\ncd ~/.syncdb\ncomposer require vielhuber/syncdb\nchmod +x vendor/vielhuber/syncdb/src/syncdb\n```\n\nNow add `~/.syncdb/vendor/vielhuber/syncdb/src/` to your path environment.\n\n### Windows (CMD)\n\n```bash\nmkdir \"%USERPROFILE%/.syncdb\"\ncd \"%USERPROFILE%/.syncdb\"\ncomposer require vielhuber/syncdb\n```\n\nNow add `C:\\Users\\xxx\\.syncdb\\vendor\\vielhuber\\syncdb\\src\\` to your path environment.\n\n## Update\n\n### Mac / Windows (WSL2) / Linux\n\n```bash\ncd ~/.syncdb\ncomposer update\nchmod +x vendor/vielhuber/syncdb/src/syncdb\n```\n\n### Windows (CMD)\n\n```bash\ncd \"%USERPROFILE%/.syncdb\"\ncomposer update\n```\n\n## Usage\n\n```bash\nsyncdb profile-name\n```\n\n## Configuration\n\nSimply put your desired configuration files in ~/.syncdb/profiles/profile-name.json:\n\n```bash\nmkdir ~/.syncdb/profiles\ncd ~/.syncdb/profiles\nnano example.json\n```\n\n```json\n{\n    \"engine\": \"mysql\",\n    \"source\": {\n        \"host\": \"200.10.10.10\",\n        \"port\": \"3307\",\n        \"database\": \"EXAMPLE\",\n        \"username\": \"EXAMPLE\",\n        \"password\": \"EXAMPLE\",\n        \"cmd\": \"mysqldump\",\n        \"ssh\": false\n    },\n    \"target\": {\n        \"host\": \"localhost\",\n        \"port\": \"3306\",\n        \"database\": \"EXAMPLE\",\n        \"username\": \"EXAMPLE\",\n        \"password\": \"EXAMPLE\",\n        \"cmd\": \"mysql\",\n        \"ssh\": false\n    },\n    \"replace\": {\n        \"https://www.example.com\": \"http://www.example.local\",\n        \"www.example.com\": \"www.example.local\"\n    }\n}\n```\n\nYou can find more examples in the profiles folder in this git repo.\n\n## Excluding table data\n\nSometimes it is useful to exclude certain table data (e.g. `logs`, `cache`, ...), while preserving the structure.\nDatabase engines don't provide a good way to do this.\nTherefore you can use the `ignore_table_data`-directive in your `json`-config:\n\n```json\n{\n    \"ignore_table_data\": [\"table1\", \"table2\", \"table3\"]\n}\n```\n\n## Privileges\n\nSince MySQL 5.7 and MySQL 8.0.21 accessing the INFORMATION_SCHEMA.FILES table now requires the PROCESS privilege. Most providers don't have this option available. This results in the error message:\n\n`Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces`\n\n`syncdb` automatically adds `--no-tablespaces` to your mysqldump-commands. You can turn off this behaviour by adding `\"tablespaces\": true` to your configuration.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvielhuber%2Fsyncdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvielhuber%2Fsyncdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvielhuber%2Fsyncdb/lists"}