chevron_left
General table Cookbook
check_circle
Mark as learned thumb_up
0
thumb_down
0
chat_bubble_outline
0
auto_stories new
settings
Backing up a table in MySQL
Database
chevron_rightMySQL
chevron_rightCookbooks
chevron_rightTables Cookbooks
chevron_rightGeneral table Cookbook
schedule Jul 1, 2022
Last updated local_offer MySQL
Tags tocTable of Contents
expand_more Check out the interactive map of data science
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?
thumb_up
thumb_down
Ask a question or leave a feedback...
thumb_up
0
thumb_down
0
chat_bubble_outline
0
settings
Enjoy our search
Hit / to insta-search docs and recipes!