MySQL : How to restore mysql dump (.sql) ignoring DROP TABLE statement? I am trying to restore multiple mysql dump (.sql) files. Data in each dump file are from the same table, but with different ID (primary key) range.

For example,

&gt; 1.sql (0 &lt; ID &amp;&amp; ID &lt;= 100)
&gt; 2.sql (100 &lt; ID &amp;&amp; ID &lt;= 200)
&gt; ...


I have 100 files like the above, each containing 'DROP TABLE IF EXISTS' and 'CREATE TABLE' statements. Because of the two statements, I can't simply automate the mysql restore command.

&gt; root$&gt; mysql &lt; dump.sql


Since every time I execute the sql, it will drop the table and delete all data restored. So I need something that I can ignore the DROP and CREATE statements while doing ...

&gt; root$&gt; mysql &lt; dump.sql


Has anyone done this before?

FYI, my OS is Amazon Linux AMI.
cat 1.sql | grep -v "DROP TABLE" | mysql --force


Assuming no other string contains drop commands this should work..

Updated: use --force to ignore errors by CREATE TABLE.