Skip to Main Content

How to merge two WordPress databases

Divi: the easiest WordPress theme to use

Easily create your website with Elementor

Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]

So, you have worked on WordPress and are ready to deploy it. There is only one problem. How do you deploy your development site without losing all the updates and new content added to the production site as you develop?

What you need is a way to compare your development database to the production database, merge the two databases, and resolve conflicts one by one. The only problem is that there is no tool for this (until now)?

Mergebot is a "beta" plugin that aims to solve the problem of database merging, and to do so in an easy to implement manner.

In this tutorial, we'll explore Mergebot, consider the pros and cons of using Mergebot, and highlight some great alternatives for database merging.

Merge bot tutorial

How does mergebot work?

What can you do with mergebot in reality:

  • You can clone a production site to a development environment.
  • You can install Mergebot on the development and production websites.
  • As you make changes to your development site, and Mergebot saves these changes.
  • Periodically you will have a new copy of the production database and you can use it to refresh the development database.

Each time you refresh your staging database you are using Mergebot to reapply changes to your staging site. This way, your development site will have your latest production data and all of your development work.

Once you are ready to deploy the work on the production site, all you will have to do is access " Tools> Mergebot And press the button to apply all your development changes and see them applied to the production site database.

In the end, you will be able to deploy changes from the development database to the production database without causing data loss.

Divi: The best WordPress theme of all time!

With over 901.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]

Let's see how to do things in practice.

Mergebot in action

The first thing to do when you start with Mergebot is to clone your production site to a development environment. Then, once you have your development site set up, install the plugin ' Mergebot On both sites.

With the plugin installed and activated, a notice will appear letting you know what you need to do to complete the installation by adding an API key for each site in the "wp-config.php" file.

Mergebot key registration

Once the Mergebot API key has been set on both development and production sites, navigate to “Tools> Mergebot” on the development site to link the two sites.

Mergebot site connection

Mergebot is now configured. However, he does not control the changes. To start keeping track of changes on the development site, you must click the button on the user toolbar.

Enable Track Changes

Now it's time to make some changes. To test things, we will create an article on the development site. Then I create a new page on the production site.

Let's see what Mergebot picked up:

Are you looking for the best WordPress themes and plugins?

Download the best plugins and WordPress themes on Envato and easily create your website. Already more than 49.720.000 downloads. [EXCLUSIVE]

Details of mergebot changes

The wording of the message in the Mergebot page of the WordPress Dashboard (Tools> Mergebot) is a bit difficult to decipher. However, by clicking on " View Queries You will access a new tab that will display all the queries registered by Mergebot.

Modifying the mergebot database

Looking through the ' changeset " than Mergebot recorded you will notice the changes to the development site that were stored on Mergebot. Now we can update our database on the development site with a new copy of the production database and then apply this " changeset ».

So, let's do it.

Refreshing the development database

Mergebot is designed to work with " WP Migrate DB Pro Which allows database cloning between two connected sites. Use " WP Migrate DB Pro »Allows updating the development database very easily. However, the developer has stated that the use of "WP Migrate DB Pro" is not necessary.

For this tutorial, I did not use " WP Migrate DB Pro ". Instead, I used the free version, to export the production database, then imported the database into my development database using phpMyAdmin.

After refreshing the dev database, I logged into the dev site again and was greeted with a message from Mergebot.

Mergebot message

In reality, I would have expected this behavior. But I admit that at the time, I was a little intrigued by this message. How to choose an option to save the requests and then check the Mergebot server for more details?

Easily create your Online Store

Download free WooCommerce, the best e-commerce plugins to sell your physical and digital products on WordPress. [Recommended]

It turns out that the queries that were captured represented a massive batch of WordPress security keys saved in the database. The generation of these queries appears to have taken place when WordPress was manually connected to the refreshed database. Obviously, I chose to ignore these changes.

Video tutorials included in the Mergebot documentation make the merge process more transparent when using WP "Migrate DB Pro". In this scenario, Mergebot recognizes what you are doing when you refresh the development database and ignores the changes applied by the database refresh.

Anyway, it created a changeset that was annoyingly oversized, but still, it worked very well. I refreshed the database again, this time choosing to ignore the new changes, and then went to " Tools> Mergebot To apply the " changeset ". The result was that the development site included all the changes made on both the production and development database.

That's all for these early days with Mergebot. We will see in a future tutorial how to deploy a changeset and limit Mergebot.

This article features 5 comments

  1. Hello,

    Currently several of us are working on a wordpress project with the wp-content folder on discord and a theme that we have created. Can we use this system to link our different databases (which are local) while avoiding potential conflicts?

  2. Thanks for this tutorial
    I have a question :
    Is it possible to link a shop management software (installed on PC or server) with a link to the database of the e-commerce site

     

  3. I test a new theme on a subdomain (offline) of the online site;
    MERGEBOT can it be the solution to this new theme on the field?
    thank you for your different always interesting post.
    Claude

    1. Hello Claude,

      Unfortunately, we cannot provide this type of assistance. Thank you for the feedback on the quality of our articles.

Leave a comment

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top
6 shares
Share4
tweet
Save2