Exporting tables to CSV format
by Taavi Rammar

To export mysql query to .csv file, do following on mysql command prompt (you need to log in first: mysql -u user_name -D database_name -p):
SELECT c1, c2, c4 INTO OUTFILE '/tmp/result.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM my_table;

Copyright by techTips