0

I have two database ms1 and ms2 with same fields and same tables. i want to merge both data from ms1 to ms2. as i have same primary keys.

Anybody have idea?

Hitu Bansal
  • 2,917
  • 10
  • 52
  • 87

2 Answers2

1

Export one table, then import it in the other database....

For example, database name: db1 and db2

The table name is tb.
Export table
1) Use phpMyAdmin, select db1
2) Click Export
3) Select db table
4) unselect Structure
5) check Save as file
6) Click Go

Import table

1) Use phpMyAdmin, select db2
2) Select db table
3) Click Import
4) Browse your exported file
6) Click Go
  • Download the trial of Navicat. If your tables have primary keys, you can compare or merge the two databases. http://wiki.navicat.com/wiki/index.p...e_structure%3F I didn't try this....but i think it will work... –  Mar 14 '12 at 05:00
  • If you don't need to maintain the old Primary Keys and the Primary Key field is set to Auto Increment, you can just set them to NULL in the import statement and it will continue on from the next available. – Mr Wednesday Mar 14 '12 at 05:13
1

Follow steps stated by @Sevak.

Export db2 table with structure and import it in db1 in a temporary table with same schema.

Now run query:

insert into table1 (all columns except primary_key)
select all_columns_except_primary_key 
from temporary_table;

Delete temporary_table if everything is ok.