Backup & Restore MySql Database Table(s)

23 / Apr / 2010 by Amit Jain 2 comments

Hi Friends,

I needed to take the backup and restore the selected table(s) of mysql database. And I found Gaurav Chauhan’s blog on taking dump of the database and to restore the database. So I tried with the same commands but with table names passed as parameters and that worked.

mysqldump -u root -p my_database Table1 Table2 > /home/amit/tablesDump.sql;

And the file the dump of Table1 and Table2 got created at /home/amit/tablesDump.sql.

To restore the table(s) back, we used the following command

mysql -u root -p my_database_2  //First we need to login to mysql

mysql> source /home/amit/tablesDump.sql;

Both tables were created in my_database_2.

Hope this helped.

Cheers!
~~Amit Jain~~
amit@intelligrape.com
http://www.tothenew.com

FOUND THIS USEFUL? SHARE IT

comments (2)

Leave a Reply

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