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:
- Import an SQL file using the command line in MySQL
- Backup only certain rows from MySQL database
- Create INSERT statement for each record with mysqldump
- Backup MySQL database without locking tables
- Backup MySQL data only
- Skip tables in MySQL backup
- Backup only selected tables in MySQL
- Backup MySQL schema only
- Backup MySQL database
Tags:
backup only certain rows, dump some records only, selected row only Technical term:
Backup only certain rows from MySQL database