Backup only certain rows from MySQL database
Question:
How to backup only certain rows from MySQL database? Answer:
mysqldump -u testuser -p testdb events --where="event_date>='2020-06-01' AND event_date<='2020-08-31'" > /tmp/backup_filtered.sql
Description:
If you want to export only certain rows from a MySQL database using mysqldump
, you can select the records using the --where
option.
It dumps only rows selected by the given WHERE
condition. Quotes around the condition are mandatory if it contains spaces or other characters that are special to your command interpreter.
Reference:
The --where option reference
Share "How to backup only certain rows from MySQL database?"
Related snippets:
Tags:
backup only certain rows, dump some records only, selected row only Technical term:
Backup only certain rows from MySQL database