PHPackages                             vielhuber/syncdb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. vielhuber/syncdb

ActiveLibrary[Database &amp; ORM](/categories/database)

vielhuber/syncdb
================

Syncs a database (mysql, pgsql) between two servers (optional via ssh tunnel).

2.0.8(1w ago)91735MITPHPPHP &gt;=8.1

Since Mar 24Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/vielhuber/syncdb)[ Packagist](https://packagist.org/packages/vielhuber/syncdb)[ RSS](/packages/vielhuber-syncdb/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (4)Versions (109)Used By (0)

[![GitHub Tag](https://camo.githubusercontent.com/e6eef9d464733bc094881a12dc3310d936d2b3bc456643a77296c950b9291159/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f7669656c68756265722f73796e636462)](https://github.com/vielhuber/syncdb/tags)[![Code Style](https://camo.githubusercontent.com/1540f8ce219727155ab62506c77b818b720421c22c4cf0b18a5f160942132e2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64655f7374796c652d7073722d2d31322d6666363962342e737667)](https://www.php-fig.org/psr/psr-12/)[![License](https://camo.githubusercontent.com/1d82a1ca86f969d89cd359dfefc2437d176a879a42b2b30c2b28154c1109ebb8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7669656c68756265722f73796e636462)](https://github.com/vielhuber/syncdb/blob/main/LICENSE.md)[![Last Commit](https://camo.githubusercontent.com/660f7ae41f35318fb8612cbc5ef7793b294556124dab83d8606a21b53dfed14a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f7669656c68756265722f73796e636462)](https://github.com/vielhuber/syncdb/commits)[![PHP Version Support](https://camo.githubusercontent.com/e3dc2bdc5d97bf81c237ded1cff263dea5a35766c98e3b44bd14d54799c3663d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7669656c68756265722f73796e636462)](https://packagist.org/packages/vielhuber/syncdb)[![Packagist Downloads](https://camo.githubusercontent.com/f5f123b307d43047a06f54b9fea3c07d12c82cf35d7c5a4b0b57c913d39c7624/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7669656c68756265722f73796e636462)](https://packagist.org/packages/vielhuber/syncdb)

🔥 syncdb 🔥
==========

[](#-syncdb-)

syncdb syncs databases between two servers.

Features
--------

[](#features)

- Most common use case: Sync your production database to your local environment
- You also can sync between any servers, even from remote to remote (without local)
- Works with direct database connections or via ssh tunnels
- Currently supports mysql and sqlite
- Has also a fast mode where the sql file is zipped (you also can choose the compression level)
- Does include a search/replace mechanism called [magicreplace](https://github.com/vielhuber/magicreplace)
- (Remote) commands like mysqldump, mysql, zip, e.g. can be overwritten manually to fit any environment
- Works on Linux, Mac and Windows (with WSL)
- Supports parallel execution of multiple syncs
- Uses optimization techniques for a faster restore
- Also supports ssh connections to servers without the support for public keys
- Shows live restore progress

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1

#### Mac

[](#mac)

Install [Homebrew](https://brew.sh) and then [coreutils](https://formulae.brew.sh/formula/coreutils):

```
brew install coreutils

```

#### Windows

[](#windows)

Choose one of the two following options:

- Install [WSL2](https://docs.microsoft.com/de-de/windows/wsl/install-win10)
- Install [Cygwin](https://cygwin.com/install.html):
    - Install all default packages + `unzip`
    - Add `C:\cygwin64\bin` to your environment PATH (high priority, but below php)

Installation
------------

[](#installation)

### Linux / Mac / Windows (WSL2)

[](#linux--mac--windows-wsl2)

```
mkdir ~/.syncdb
cd ~/.syncdb
composer require vielhuber/syncdb
chmod +x vendor/vielhuber/syncdb/src/syncdb
```

Now add `~/.syncdb/vendor/vielhuber/syncdb/src/` to your path environment.

### Windows (CMD)

[](#windows-cmd)

```
mkdir "%USERPROFILE%/.syncdb"
cd "%USERPROFILE%/.syncdb"
composer require vielhuber/syncdb
```

Now add `C:\Users\xxx\.syncdb\vendor\vielhuber\syncdb\src\` to your path environment.

Update
------

[](#update)

### Linux / Mac / Windows (WSL2)

[](#linux--mac--windows-wsl2-1)

```
cd ~/.syncdb
composer update
chmod +x vendor/vielhuber/syncdb/src/syncdb
```

### Windows (CMD)

[](#windows-cmd-1)

```
cd "%USERPROFILE%/.syncdb"
composer update
```

Usage
-----

[](#usage)

```
syncdb profile-name
```

Configuration
-------------

[](#configuration)

Simply put your desired configuration files in ~/.syncdb/profiles/profile-name.json:

```
mkdir ~/.syncdb/profiles
cd ~/.syncdb/profiles
nano example.json
```

```
{
    "engine": "mysql",
    "source": {
        "host": "200.10.10.10",
        "port": "3307",
        "database": "EXAMPLE",
        "username": "EXAMPLE",
        "password": "EXAMPLE",
        "cmd": "mysqldump",
        "ssh": false
    },
    "target": {
        "host": "localhost",
        "port": "3306",
        "database": "EXAMPLE",
        "username": "EXAMPLE",
        "password": "EXAMPLE",
        "cmd": "mysql",
        "ssh": false
    },
    "replace": {
        "https://www.example.com": "http://www.example.local",
        "www.example.com": "www.example.local"
    }
}
```

You can find more examples in the profiles folder in this git repo.

Excluding table data
--------------------

[](#excluding-table-data)

Sometimes it is useful to exclude certain table data (e.g. `logs`, `cache`, ...), while preserving the structure. Database engines don't provide a good way to do this. Therefore you can use the `ignore_table_data`-directive in your `json`-config:

```
{
    "ignore_table_data": ["table1", "table2", "table3"]
}
```

Privileges
----------

[](#privileges)

Since 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:

```
Error: 'Access denied; you need (at least one of) the PROCESS
privilege(s) for this operation' when trying to dump tablespaces

```

`syncdb` automatically adds `--no-tablespaces` to your `mysqldump`-commands.
You can turn off this behaviour by adding `"tablespaces": true` to your configuration.

Shared hosts
------------

[](#shared-hosts)

`syncdb` works flawlessly with libraries like [ftpsh](https://github.com/vielhuber/ftpsh):

```
    ...
    "cmd": "/var/www/ftpsh/ftpsh.sh --env /path/to/project.env mysqldump"
    ...

```

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance95

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~1 days

Total

108

Last Release

7d ago

Major Versions

1.9.9 → 2.0.02026-05-22

PHP version history (2 changes)1.0.1PHP &gt;=5.6

1.9.5PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3183737?v=4)[David Vielhuber](/maintainers/vielhuber)[@vielhuber](https://github.com/vielhuber)

---

Top Contributors

[![vielhuber](https://avatars.githubusercontent.com/u/3183737?v=4)](https://github.com/vielhuber "vielhuber (123 commits)")

---

Tags

databasemysqlsqlsync-database

### Embed Badge

![Health badge](/badges/vielhuber-syncdb/health.svg)

```
[![Health](https://phpackages.com/badges/vielhuber-syncdb/health.svg)](https://phpackages.com/packages/vielhuber-syncdb)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
