How to find two DB difference script in MySQL

By W.Zh

In MySql , it is often you want to find two version of DB to create the script , especially for DB migrate and schema upgrade. Here is the way to use the Workbench to create the SQL file for it:

  1. On the Workbench, Going to model mode(Left bottom corner to create one Model if do not have), only in model mode you can access it.
  2. Menu –> Database -> Synchronize with any source–> Select Database Updates:
    Check : “Source”- Live Database Server
    “Destination”-Live Database Server
    “Send Updates to:” –> Alter Script Files:

    If you just want to save DB diff to sql, not immediately to sync one DB to another DB, such as find schema change between Staging and Dev server . Then remember to select     “Send Updates to:”, instead of directly sync to target DB.

  3. Then after first step. just follow the wizard to step by step to get your diff files.
Advertisements