MySQLDump exports some data

MySQLDump is a very commonly used database export tool. However, most of the time, we use mysqldump -uuser -p database_name > database_name.sql

This can provide the data export function, but the exported data will be full table data. When we export data, if we want to export some data, we need to use the --where Flag to export some data.

In addition, since the exported data is part of the data, it is necessary to specify the table name when exporting, so that the corresponding data can be exported, and the following formats need to be met

 mysqldump [OPTIONS] database [tables]

For example, suppose we need to export data whose ID is less than 20 in the wp-options table of the database wordpress, we need to execute the following command:

 mysqldump --where="id < 20" wordpress wp-options

The above command implements the export of data that meets specific requirements from the database.

This article is reprinted from: https://www.ixiqin.com/2022/05/09/mysqldump-export-section-data/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment