Restore a specific table from MySQL Dump

 

In order to restore a particular table from an entire DB DUMP first we need to extract the content of that particular table from the entire DB dump.

 

Note: Please be very careful when performing this on a Live database, make sure you have taken a backup before performing any changes. We are not responsible for any Data Loss.

 

Run the below command on the db dump file to extract the content of the table that you need

 

sed -n -e '/CREATE TABLE.*`TABLENAME`/,/CREATE TABLE/p' MYSQL-FULL-DUMP-FILE-NAME > NEW-DUMP.SQL

 

Note: Replace the TABLENAME with the desired table name that you want to extract.

Once the above step is done, restore the DB with the newly create dump (NEW-DUMP.SQL in our case)

Updated: January 20, 2020 — 3:48 pm

Leave a Reply

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

10 + seventeen =

www.hostingdada.net © 2016