Query to file

SELEC * FROM table_name INTO OUTFILE ’/tmp/tiedosto.csv’  FIELDS TERMINATED BY ’,’  ENCLOSED BY ’”’ LINES TERMINATED BY ’\n’;