background top

Generate Change Script for MySQL Modifications

After reading a blog post called “Generate Change Script for SQL Modifications” for MSSQL Management Studio, we wanted to show how to do this same task for MySQL using the MySQL Query Browser.

  1. Open the Query Browser and right click on the table you need to modify.
  2. Select Edit Table from the context menu. You will be presented with the MySQL Table Editor.  This gives you a graphical interface for modifying your table structure.
  3. Modify the table in whatever way you wish.MySQL Table Editor

    Some examples…
    - change field names, types, defaults
    - add indices, foreign keys
    - change the character sets and collation
    - change the auto increment value

  4. Click Apply Changes at the bottom of the window. You will be presented with a confirmation box.  CHANGES HAVE NOT BEEN EXECUTED YET.  What’s great is that it gives you the code that it will use to modify the table.MySQL Confirm Table Edit
  5. Use your cursor to select the code and then copy it into whatever text editor you prefer.

Now you have a sql script that can be executed on multiple servers, or further modified by hand.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • TwitThis

One Response to “Generate Change Script for MySQL Modifications”

  1. Ravi M Says:

    Hi,
    Above discussion is looking good . but i need script file for table without editing after creation of table in mysql query browser .can you help me to create above discussed script file

Leave a Reply