How to Merge Two MySQL Databases Print

  • cPanel, MySQL databases, phpMyAdmin
  • 425

Merging two MySQL databases involves combining their data while ensuring no conflicts or data loss. The simplest way to demonstrate this is by showing how to transfer data from one table to another.

Both databases must reside under the same account. If they are not, you’ll need to back up one of them and transfer it. (In cases where both databases share the same name, you’ll also need to rename one before transferring it).

After making sure both databases are on the same account, you can access cPanel to proceed.

cPanel

STEP 1: Log in to cPanel.

There are two methods to log into your cPanel.

  • Method 1: Log in to your cPanel directly.
  • Method 2: Log in to your cPanel through your Customer Portal.

Through your Customer Portal;                          

  • Log in to your Customer Portal.
  • Click on "Log in to cPanel".
  • Login-to-cPanel

STEP 2: Locate the Databases section and click on phpMyAdmin.

cPanel - Databases Section - phpMyAdmin

STEP 3: Navigate to the SQL tab at the top.

cPanel - phpMyAdmin - SQL tab

STEP 4: You’ll see the section labeled Run SQL query/queries on server 'localhost':

STEP 5: Enter the following command in the text box, making sure to replace DB1 and DB2 with the appropriate database names, and TABLE1 with the name of the table you wish to merge:

INSERT INTO DB1.TABLE1 SELECT * FROM DB2.TABLE1;

STEP 6: Click the Go button to execute the query.

SQL - Command - Go

Repeat this process for any additional tables you want to merge.


Was this answer helpful?

« Back