How to backup and restore a mysql table from a database using mysql command


Here we are going to discuss about how to restore a few tables from a database to a new empty database, the key point is that we don’t want to restore the entire database to the new database, only a few tables.

♦ Backup a table from a database

 mysqldump "databasename" tablename > "tablename".sql

♦ Restore a table to a database

 mysql "new-databasename" < "tablename".sql

Now database named as “new-databasename” is restored with the selected tables from the sql file “tablename”.sql



There are no revisions for this post.

Tags: , , ,

No comments yet.

Leave a Reply