Mysql – How to import a single table in Windows environment

exportimportMySQLmysqldump

I am running Windows 7 with xampp. I can easily import a database with the following command:

mysql -u user -p database < backup.sql

The problem is that I have a database around 8.5 GB, which take a long long time to import. Mostly I just need to restore a single table from it.

How can i restore single table in this environment?

Best Answer

This issue has been dealt with here. The approach described therein assumes that you have already separated your schema dump by filename.

However, if I've understood you correctly, you have a schema dump from which you wish to extract a single file? I have written a small tool which extracts individual table data separately from a schema dump file.

It's called MySQLDumpSplitter. If it doesn't suit your needs, there are two others with the same name also on Github. A Google of "mysqldump file split" or similar will lead you to other tools.

Once you have your Table_name.sql file, just follow the steps outlined in the first link.

DISCLAIMER: I wrote the linked tool. Its limitations are described on the page - you may find others which work better for you.