Dump just the table structure to a file in MySQL

Published January 13, 2010 by Siva

We will use the mysqldump utility the same as if we were backing upo the entire database

Syntax:

mysqldump -d -h localhost -u root -p databasename > dumpfile.sql

The only option that is different than creating an entire backup is the -d switch, which tells mysqldump not to output the data.

Example:

mysqldump -d -h localhost -u root -p sampledatabase  > dumpfile.sql

Advertisements

2 comments on “Dump just the table structure to a file in MySQL

  • Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

    %d bloggers like this: