Mysql restore to restore structure and no data from a given backup (schema.sql)

database, mysql, restore

Solution

Dump database structure only:

`cat backup.sql | grep -v ^INSERT | mysql -u $USER -p`

This will execute everything in the backup.sql file except the INSERT lines that would have populated the tables. After running this you should have your full table structure along with any stored procedures / views / etc. that were in the original databse, but your tables will all be empty.

Problem

Hi I use mysql administrator and have restored backup files (backup.sql). I would like to use restore the structure without data and it is not giving me an option to do so. I understand phpadmin provides this. I can not use this however. Any one can tell me an easy way?

Original source