Export Mysql Database Structure Without Data

Sometimes you can get in need of your favourite Database clone, but you do not need all the garbage of your 3 years old data.

mysql

Well, a part for a Looong DBMS constructs to cancel every peace of data from your tables, you can simply dump your DB with the _--no-data _switch. This option is there right to dump a Mysql DB structure without the data!

Simply as:

mysqldump -u [User] -p [DBname] --no-data | gzip >  MyDBBackup.gz

And here we go, we have a new and shiny compressed DB Structure without data. Just to conclude, we can now create the new DB perhaps we can DROP the old one and restore it (remember to take a full backup before this) with

gzip -d  MyDBBackup.gz | mysql -u [user] -p [DBname]