Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
export from RDS mysql to a CSV
# on mac, replace TABGOESHERE with a tab by typing Ctrl-V then the Tab key
mysql -u USERNAME --database=dbname --host=HOST --batch -e "select * from tablename" |
sed 's/TABGOESHERE/","/g'| sed 's/^/"/g' | sed 's/$/"/g' | sed 's/\n//g' > destination.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment