command line interface - Export MySQL Table to .tsv from a remote server without using `INTO INFILE` -
i have large table on amazon rds instance need export .tsv specific settings. cannot use into outfile
on rds instance. must export table onto local drive of server i'm logging rds mysql instance with.
i have specific settings need specify .tsv. are:
- terminate \t
- wrap nothing
- escape backslash
- null values blank
how do command line?
you can this-
mysql -uroot -proot -h "mysql.host.url" -n -b -e "select * world.city" | sed 's/null/ /g' > test.tsv
-n tells not print column headers. -b "batch mode", , uses tabs separate fields. null replaced space.
for 100 gb databases , may help-
mysql -uroot -proot -h "mysql.host.url" -n -b -e "select * world.city" > test.tsv sed 's/null/ /g' < test.tsv > new.tsv
but recommend huge databases should use etl tools.
Comments
Post a Comment