MySQL import - How to ignore Drop table if exists line?
database, mysql
Solution
If you do not want to make dump once again and you are using Linux you can go with:
awk '!/^DROP TABLE IF EXISTS/{print}' <dump.file> | mysql <db_name>
If you want to dump data once again you should pass `--skip-add-drop-table` to mysqldump utility.
Problem
I exported 2 identical databases(identical in terms of names and structures of tables) into two .sql files using mysqldump. I want to merge them into one file. However, both the databases have a 'Drop table' line before every table. What that means is if I import db1 and then db2, db1 tables are dropped before db2 tables are imported. The files are huge and I am not able to open them in the editor. Also, there are 50 tables in each databases. How can I ignore the Drop table command during mysql import?