Monday, 23 April 2018

How to Take Backup of a specific Table in MySQL

Sometimes, there is a requirement to make a backup of a specific table in MySQL. The complete database backup could take more time to complete. Instead of backing up the entire database, we can make the backup of a single table using mysqldump.

The mysqldump script included option for single table backup and excluding tables from a database.

Syntax to backup single table from a database:

[root@linuxcnf ~]# mysqldump -u [username] –p [password] [dbname] [table] > bkp_filename.sql

Example to backup single table from a database:

This example takes a backup of table test_table and dumps the output to test_table.sql

[root@linuxcnf ~]# mysqldump –u [username] –p [passowrd] test_db test_table > test_table.sql
[root@linuxcnf ~]# 

Table backup is done!!!

No comments:

Post a comment