MySQL: Sync only missing tables
I'm trying to sync two MySQL databases. Not by means of replication, that's already setup in a different environment.
Basically, the two envinronments we have are a QA environment and a production environment. We are looking to deploy a new product and our QA team have missed some steps in documenting the database inserts.
The problem I have is I have a production environment that has a replicating (active/passive) setup. It is missing several tables that QA has and they don't know which are missing and are recieving tons of databases errors related to missing tables.
Is there a way to export the database (I'm using -d so that only the structure comes over, no data) and only have MySQL insert the missing tables?
If not, my solution would be to just wipe our our production instance and refresh it with our QA instance with no data.
If you add --skip-add-drop-table (or --skip-opt), there won't be any drop statements for your tables. If you run the dump on your other database, the create statements for existing tables will fail, but shouldn't affect anything.
I can't see any option for mysqldump to add "if not exists" for create tables, but I'm not sure you really need it.