I have two large MySQL databases with identical schemas that I want to merge. To do that I want to increase every foreign key (and id, naturally) of one database by 10 million, and then insert all the records of the modified db into the other db.
I have thought about editing the mysqldump with tools like grep and gawk, but that seems very hard to do. What would be the best approach?
OK, so here is the solution that I implemented, using the
information_schemaand a bash script. First I get every key-column in the database and the table in which it occurs, and then I update each of those columns.