Skip to content

Instantly share code, notes, and snippets.

@goldenboy
Forked from sr3d/gist:134895
Created February 16, 2012 14:25
Show Gist options
  • Save goldenboy/1845201 to your computer and use it in GitHub Desktop.
Save goldenboy/1845201 to your computer and use it in GitHub Desktop.
Dump a table to a CSV file
mysql -h HOST -u USERNAME --password=PASSWORD DATABASE -B -e "SELECT id,email,first_name,last_name,state,zip_code FROM users" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment