In this post, I am sharing a solution to take an only table or few tables backup in MySQL and also sharing solution like, How you can ignore few tables while taking a backup of MySQL Database.
In last year, I shared a basic article on how to take a backup of the database in MySQL, which also you can access here.
The copying data from one server to another, data migration, the backup requirement for specific data or object or stored procedure, data versioning – These all are part of DBA’s day to day activity, and N number combinations are there.
There are many options available for mysqldump utility, so I am using few options to play for table backup only. Let me explore few options related to table backup in MySQL.
Take a backup of a single table:
1
|
mysqldump -u <db_username> -p db_name table_name > table_name_backup.sql
|
Take a backup of multiple tables:
1
|
mysqldump -u <db_username> -p db_name table_name_1 table_name_2 table_name_3 > tables_backup.sql
|
Ignore a table from full database backup:
1
|
mysqldump -u <db_username> -p db_name --ignore-table=db_name.table_name_1 > db_backup.sql
|
0 comments:
Post a Comment