0

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?

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

2 Answers 2

1

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

1
  • 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, 2019 at 13:08
0

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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