Skip to content

Instantly share code, notes, and snippets.

@postnati
Created May 27, 2011 15:10
Show Gist options
  • Save postnati/995445 to your computer and use it in GitHub Desktop.
Save postnati/995445 to your computer and use it in GitHub Desktop.
MySQL CSV using mysqldump
mysql --user=root --password='' -e "SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR '\t') FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='phineas_and_ferb' and table_name='characters' INTO OUTFILE '~/tmp/output.txt' FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '' ESCAPED BY '' LINES TERMINATED BY '\n';"
mysqldump --single-transaction --user=root --password='' -T ~/tmp/ phineas_and_ferb --fields-enclosed-by=\"
cat ~/tmp/characters.txt >> ~/tmp/output.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment