Skip to content

Instantly share code, notes, and snippets.

@Elijen
Created April 11, 2013 09:51
Show Gist options
  • Save Elijen/5362108 to your computer and use it in GitHub Desktop.
Save Elijen/5362108 to your computer and use it in GitHub Desktop.
Export from MySQL to CSV directly
SELECT id, name, email INTO OUTFILE '/tmp/result.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
ESCAPED BY ‘\\’
LINES TERMINATED BY '\n'
FROM users WHERE 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment