Created
August 1, 2012 18:52
-
-
Save wsantos/3229755 to your computer and use it in GitHub Desktop.
Export direct from mysql console to csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export | |
SELECT id, field1, field2, field3 | |
INTO OUTFILE '/tmp/data.csv' | |
FIELDS TERMINATED BY ',' | |
OPTIONALLY ENCLOSED BY '"' | |
ESCAPED BY '\\' | |
LINES TERMINATED BY '\n' | |
FROM data_table | |
WHERE field1 = 0; | |
# Permissions | |
USE mysql; | |
UPDATE user SET File_priv = 'Y' WHERE User = 'db_user'; | |
FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment