Monday, July 28, 2008

MySQL - Restoring a Single Table from a Huge mysqldump File

http://blog.tsheets.com/2008/tips-tricks/mysql-restoring-a-single-table-from-a-huge-mysqldump-file.html

Restoring a single table in Mysql

Take a backup of the table which your looking to restore using mysqldump.
mysqldump -u -p >

ex:mysqldump -usridhar -pthajes testdb usermas > /home/sridhar/mysqldump/tablebackup.txt

where we get only usermas table backup.

for restoring to another db. use
mysql < /home/sridhar/mysqldump/tablebackup.txt
ex: mysql restDB < /home/sridhar/mysqldump/tablebackup.txt .

Note: If restDB has already usermas table, pls drop before restoring.