简体   繁体   中英

Merge two large MySQL databases whilst maintaining referential integrity

I have two large (6GB and 8GB respectively) MySQL databases which have identical schemas, and a common history up until about 6 weeks ago.

They differ from that point, and therefore, after that point, will have conflicting primary keys.

I want to merge these two databases - whilst maintaining referential integrity.

Initially, I tried to diff the databases using git, however git falls over when trying to resolve deltas on BLOBs within the databases.

Can anyone suggest a way of doing this?

Edit : Although it would have been a good idea at the time, I don't have any binary logs for either database

I think a good idea is make a script to migrate data and then iterate over the small database and add the records to the bigger database.

Make tests in a development environment and after confirm that it works, run in production.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM