Out put a result of a MySQL query into a CSV file
SELECT * FROM m_table INTO OUTFILE '/tmp/orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';