August 31, 2010

Export MySQL database to CSV file

SELECT * INTO OUTFILE '/tmp/result.text'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM test_table;

And the results are sent to /tmp/result.text in CSV format.

No comments:

Post a Comment