This is a short guide how to use Mysql Workbench tool to compare and synchronize two database schemas.
We have two (or more databases) with a primary one considered “source” and the rest considered “targets”. Our goal is to make sure that we synchronise the structure of the “source” with the rest of the databases.
(select your source db) → Database → Reverse Engineer
Go through every option in the new popups. Select source db (“prima”) as schema to be reversed when required. By the end of this procedure, two more tabs should appear (MySQL Model and EER Diagram)
Also the menu should contain now new options. We’re gonna use Database → Synchronize Model
Again, a couple of choices to be made. You can proceed by the default ones until you hit Select Schemata (4th screen). Here you should have the Model Schema already selected as “prima”. In order to work, select from the dropdown the target db (“secunda”) and click “Override Target”. Your result should look like in the next screenshot:
Going for the next steps, you’re gonna reach “Select Changes to Apply”. Here you can easily check for the differences.
Going for the next step you can see actually the sql produced and that needs to be applied for your schemas. You can do that either manually (after reviewing it) or just automatically using MysqlWorkbench.