First, do a mysql dump to get the entire schema / database.

Then, use this sed command to select from the first line, to the last line, of that specific table.
The first line is from the ‘drop table’, and the last is the UNLOCK TABLES.

sed -n -e '/DROP TABLE.*table_name/,/UNLOCK TABLES/p' yourDumpFile-FullDB.sql > dumpfile-justTableName.sql

You can then test / check the validity of the SQL by catting out the whole file, or the first and last lines.
It should drop the table, create it, lock it, and import the data, then unlock.

More Articles