The mysqldump tool is provided by MySQL to export MySQL database objects and data. You can use the --help parameter to view the help documentation. This topic only describes the frequently used commands and parameters of mysqldump.
Export table data (without schemas) of a specified database
Run the following command to export the table data (without schemas) of a specified database:
mysqldump -h 127.1 -ur*** -P3306 -p****** -t TPCH > tpch_data.sql
Before the table data is exported, the table is locked by the data initialization SQL statement to prevent data writes by other sessions. Then, mysqldump executes the INSERT INTO statement to write data. The VALUES parameter of the INSERT INTO statement may include many values. This means that multiple values are inserted at a time.
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES ('a'),('middle');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
Notice
mysqldump can also export data into a CSV file.