I have a full database export (single file, schama + data), but I would like to import only the database schema. Is there any magic option or trick to achieve this? I'm NOT able to perform a "mysql_dump --no-data" at the original database at this moment. Is removing all inserts and updates manual (awk/grep/vim) from the dump file the only option?

  • Edit the dump file and copy out only the schema part. – Dave Apr 12 at 13:19

A mysqldump is only inserts, not updates. So grep -v "^INSERT" dump.sql should be sufficient. Take a look before using

  • I was expecing a magic option for mysql import, but finaly, I have filtered out the inserts. Even if the dump file was 2+GB, it went quite well. – psad Apr 16 at 13:08
  • Glad it when well. Please accept this answer. – danblack Apr 17 at 0:15

Next time, do

mysqldump --no-data ...

to get just the schema.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.