Exporting data from a MySQL database using SELECT…INTO OUTFILE


 

This article is part of Robert Sheldon’s continuing series on Learning MySQL. To see all of the items in the series, click here.

In the previous article in this series, I introduced you to the MySQL LOAD DATA statement, which lets you retrieve data from a plain text file and insert it into a table. In this article, I cover the SELECT…INTO OUTFILE statement, a type of SELECT statement that includes the INTO OUTFILE clause. The clause lets you export data from one or more MySQL tables into a plain text file, providing a counterpart to the LOAD DATA statement.