0

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?

1
  • If the dump contains the create table statements, you can use some text file tools to split the file on those, locate the right one and use only that (or use any text editor able to handle big files to do the same) - or just grep tablename (with sufficient -B and -A) and you should get most of the relevant data.
    – jkavalik
    Jan 15, 2016 at 8:57

1 Answer 1

1

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.

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.