Friday, March 29, 2013

How to take backup of a table of a database



Use command "mysqldump" for taking backup of 1 table.

The mysqldump utility provides many options to take the backup of data as per user requirement. You can specify the name of table be backup in while executing the mysqldump utility.

[root@akwal ~]# mysqldump -u root -p YOUR_DATABASE_NAME TABLE _NAME > TABLE_NAME.sql


To Restore the backup


[root@akwal ~]# mysql -u root -p YOUR_DATABASE_NAME < TABLE_NAME.sql


Use command "mysqldump" for taking backup of 1 table in *.gz


[root@akwal ~]# mysqldump -u root -p YOUR_DATABASE NAME TABLE _NAME | gzip -9 > TABLE_NAME.sql

0 comments: