MySQL export to CSV

This method is very efficient, I’ve tried it with very large data sets.

1
2
3
4
5
6
SELECT c.id, c.firstname, c.phone
FROM contact c
INTO OUTFILE '/full/path/destination/file.csv'
FIELDS TERMINATED BY ';'
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>