Question

I'm wanting to consolidate numerous MySQL databases, all with the same schema definition, into a single database. If I have a dump file from each database, how will I import them all into the same database without their primary keys and foreign keys clashing?

Is there a fairly simple way to do this, or will I need to write some custom code that understands the data and creates a consolidated set of records 'manually'?

Was it helpful?

Solution

Either write custom code, or figure out the maximum primary key value in each and consolidate the files, but increase the primary keys in each database so that they don't clash. That's assuming you don't need to remove any duplicates that might exist, which would be a manual process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top