Wednesday, February 27, 2013

Restore a single table from a whole db backup mysql


suppose we have dump.sql file for backup of whole database

fire following command
grep -n 'Table structure' dump.sql

suppose the table you want is shown with 40th line
and the table next to it is 62th line

extract the table using following command
sed -n '40,61 p' dump.sql > t2.sql

then restore table using mysql utility using t2.sql

No comments: