Skip to content Skip to sidebar Skip to footer

How To Merge Two Mysql Databases Of Same Structure

Here's my situation. I've got my current database (let's call it current_db) that is up to date, but its data are incomplete because of a recent crash. Some datas have been deleted

Solution 1:

  1. Use phpMyAdmin ( Install if you still don't use it )
  2. Go to the current database
  3. click import and import the other database

Possible Issues :

  • The max file upload size in phpmyadmin may be 2MB.To solve this increase the maximum file upload size php.ini

    Assume you have a schema s1 and a schema s2.

To insert all rows of a table in s1 into a table in s2, while overwriting existing lines, you can use:

REPLACE INTO s2.table_name
SELECT*FROM s1.table_name;

If you do not want to touch existing lines:

INSERT INTO s2.table_name
SELECT * FROM s1.table_name
ON DUPLICATE KEY IGNORE;

Comment here if you have any issues.

Post a Comment for "How To Merge Two Mysql Databases Of Same Structure"