MySQL – Restore a Single Table from a FULL mysqldump file

Use the sed command on your bash shell to separate the data of the table that you want to restore. For example, if we want to restore only the “film_actor” table to “sakila” database we execute the script below.


sed -n -e '/DROP TABLE.*`mytable`/,/UNLOCK TABLES/p' mydump.sql > tabledump.sql

You can now import the newly created table dump file into MySQL database.

mysql -u root -p sakila < film_actor.sql

Cheers!

Knowledge worth sharing...Share on linkedin
Linkedin
Share on facebook
Facebook
Share on google
Google
Share on twitter
Twitter
Bookmark the permalink.

Leave a Reply

2 Comments

  1. Pratibha Jagnere

    Thank you so much, it saved my partial database

Leave a Reply

Your email address will not be published. Required fields are marked *