chevron_left
General table Cookbook
0
0
0
new
Backing up a table in MySQL
Database
chevron_rightMySQL
chevron_rightCookbooks
chevron_rightTables Cookbooks
chevron_rightGeneral table Cookbook
schedule Jul 1, 2022
Last updated MySQL
Tags tocTable of Contents
expand_more We can back up a MySQL table to a .sql
file using the below command:
mysqldump -u {username} -h {host} -p database_name table_name > /filepath/backup.sql
To backup the table with a particular condition applied:
mysqldump -u {username} -h {host} -p database_name table_name --where="id=3" > /filepath/backup.sql
To backup the table to a compressed sql .sql.gz
file:
mysqldump -u {username} -h {host} -p database_name table_name | gzip > /filepath/backup.sql.gz
From the .sql
or .sql.gz
file created, it is possible to restore and recreate the table at a later point in time.
Published by Arthur Yanagisawa
Edited by 0 others
Did you find this page useful?
Ask a question or leave a feedback...
0
0
0
Enjoy our search