Backup & Restore MySql Database Table(s) « Intelligrape Groovy & Grails Blogs

Backup & Restore MySql Database Table(s)

Posted by

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.intelligrape.com

This entry was posted on April 23rd, 2010 at 1:51 pm and is filed under Database . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Responses to “Backup & Restore MySql Database Table(s)”

  1. Gaurav says:

    Never knew that it would be so easy. Thanks for sharing..

  2. hitesh says:

    It helped ..thanx :)

Leave a Reply