Export MySQL query into a CSV file
Sometimes we need and easy way to export data from MySQL to a CSV format, with the following query you can do it directly!
SELECT * INTO OUTFILE '/tmp/export.csv' FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' ESCAPED BY ‘\\’
LINES TERMINATED BY '\n'
FROM customers WHERE 1
Written by Julián Duque
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mysql
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#