Description:
INTO OUTFILE is great option for some use cases. Specifically when I use mysql for preliminary data wrangling in data science. Once data is ready, exporting to a csv is most practical for repeated exploratory data analysis. Once secure-file-priv= is set, this feature needs 2 options. The ability to include column headers as row 1. And the ability to replace a file if it already exists. (See Suggested Fix)
How to repeat:
New feature request. The "bug" is having to work around these limitations of the INTO OUTFILE
Suggested fix:
Add two options to the INTO OUTFILE query extension
1) INTO OUTFILE WITH HEADERS
To include the column headings as row 1 of the file
2) INTO OUTFILE CREATE OR REPLACE
To allow the file be overwritten if it already exists.
Here's a complete example...
SELECT *
FROM extendedchange
ORDER BY date_time DESC
INTO OUTFILE WITH HEADERS CREATE OR REPLACE '/Users/me/Documents/Dumps/extendedchange.csv';