Posts Tagged "sql"

MySQL Export to CSV File

Ever needed to export data from MySQL into a CSV file? Its actually fairly simple,

SELECT * INTO OUTFILE ‘/tmp/name.csv’
FIELDS TERMINATED BY ‘,’
OPTIONALLY ENCLOSED BY ‘”‘
ESCAPED BY ‘\\’
LINES TERMINATED BY ‘\n’
FROM [tablename]

Certainly easier then writing a quick Python/Perl/PHP script to do the job.

via MySQL Export to CSV File.