How do you push a local database to your live one? Have you been manually exporting then importing the SQL files?
I’ve been doing that for years until I found this plugin called WP Sync DB.
Follow the guide below for installation process:
Step 1: Download and Activate it in BOTH Local and Live sites.
Why is the plugin not in WordPress.org repository?
Because the creator forked it from another plugin called WP Migrate DB which is already in wordpress.org.
Is the link above your own forked version?
Yes, the creator abandoned the plugin and I need to add nginx support to it.
Is it safe to use?
From my 3 years of experience using it, I’ve never got any fatal error.
The way it works is it creates temporary tables and only replace your real table if the migration is a 100% success.
So the worst it could do is adding some unused tables in your database that you can easily drop.
Having said that, it’s never a bad idea to have a periodic backup of your website, in case of human error.
Step 2: Get the API Key from Live Site
In your live site, go to Tools > Migrate DB, click “Settings” tab and follow the steps below:
- Tick all three checkboxes.
- Copy the API Key.
Step 3: Push Local Site
In your local site, go to Tools > Migrate DB and follow the steps below:
- Select “Push” and paste in the API Key.
- Setup the Find & replace. Don’t forget to replace the protocol like
- Tick “Media Files” if you want to sync images too.
- Save the setting so it can be reused in the future.
- Click “Migrate DB & Save”.
Done! It will open a popup showing the progress like below:
Common Error: transfer_chunk
The connection failed, an unexpected error occurred, please contact support. (#121 - scope: transfer_chunk)
This error is caused by an unstable internet connection. Even a slight disturbance can break the progress of your push or pull.
This is the biggest weakness of this plugin.
If you can’t get better internet, what you can do is to migrate few tables at a time by selecting it in the setting like below:
I have tried many migration plugin and this is the best free plugin you can get. Another promising plugin is VersionPress, but it hasn’t been production-ready for like 2 years.
For migrating theme files, I’m using Github Action that automatically uploads changed files on commit. I will create a tutorial about that in the future.
Let me know if you trouble setting up WP Sync DB plugin in the comment below 🙂