Skip to content

Instantly share code, notes, and snippets.

@badah
Created March 26, 2019 22:01
Show Gist options
  • Save badah/107b4d6195b06a210044991772482166 to your computer and use it in GitHub Desktop.
Save badah/107b4d6195b06a210044991772482166 to your computer and use it in GitHub Desktop.
MYSQL: Export to .csv file
mysql -u{user} -p{pass} -h{host} {database} -e "{sql}" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > /{path}/my-export-{time}.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment