It is possible to dump a specific table and specific rows from a table using mysqldump. This article explains how to do that.
The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data. It dumps one or more MySQL databases for backup or transfer to another SQL server. The mysqldump command can also generate output in CSV, other delimited text, or XML format.
We can control the backup set that is to be written to the dump file by using a variety of options or flags, such as whether or not to include data, whether to include one database or several, whether to lock the tables, whether to include database objects, whether to include filtering objects, and so on.
The below example will let you know how to filter the data while writing it to the file.
mysqldump MyDB MyTable –where=“id <= 100” > MyDBBackup.sql
mysqldump MyDB MyTable –where=“id >= 100 and status = 1” > MyDBBackup.sql
Hope you find this article helpful.
Happy learning!!