Save MySQL query results into a file

Sometimes, phpMyAdmin doesn’t export queries properly. To get your file, you can add options to you query to save the result into a file.

SELECT cotisation.date_creation
FROM cotisation
WHERE cotisation.code_suppression =0
INTO OUTFILE '/home/transfert/cotisations_201212.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY "'"
LINES TERMINATED BY '\n'

Leave a Reply