Export Create Table Scripts on MySQL

If you’re coming from another database environment such as Microsoft SQL Server and you’re looking to generate create table scripts on Windows with MySQL, you may want to consider the following options …

  • mysqldump.exe

  • From the command prompt, navigate to your MySQL bin directory and use the mysqldump.exe command-line application as follows…

    mysqldump -u USER --password="MYPWD" DBNAME --no-data > create_tables.sql

    If you leave off the –no-data argument, mysqldump will dump the entire database into the create script. The mysqldump.exe documentation explains all the possible arguments and there are very useful user comments/scripts at the bottom of the online documentation page.

    To bring a database script back into MySQL:

    mysql.exe DBNAME < create_tables.sql

  • MySQL Query Browser - Windows application
  • Within MySQL Query Browser, right click on a particular table (under a particular database in the Schemata treeview) and select "Copy CREATE statement to clipboard." This option will allow you to copy and paste the MySQL create table script into your favorite text editor.

    Also, while inside the MySQL Query Browser, you can open a new Script tab under "File-> New Script Tab" (or by pressing Ctrl + Shift + T). Once the script tab is open, drag tables onto the script tab to generate the CREATE TABLE script.

More useful links and information concerning how to generate MySQL create table scripts...

Discussion Area - Leave a Comment

You must be logged in to post a comment.

Nolan Bailey

Create Your Badge