December 17, 2009

How to take Table Backup in Mysql

Table Backup

The mysqldump can be used to dump a database or a collection of databases for backup or for transferring the data to another MySQL server.

Execute the following command to get the dump of a table.
$ mysqldump -uusername -p databasename tablename > dump_filename.sql

This table can be added to the database using the following command.
$ mysql -uusername -p databasename < dump_filename.sql In order to take dump of N tables named table1, table2.table3....tableN use the following syntax: $ mysqldump -uusername -p databasename table1 table2 table3 .... tableN > dump_filename.sql

No comments:

Post a Comment