I have a very large table on an Amazon RDS instance that I need to export as a .tsv with specific settings. I cannot use INTO OUTFILE
on the RDS instance. So I must export the table onto the local drive of the server I'm logging into the RDS MySQL instance with.
I have specific settings I need to specify for the .tsv. They are:
How do I do this from the command line?
You can do this-
mysql -uroot -proot -h "mysql.host.url" -N -B -e "select * from world.city" | sed 's/NULL/ /g' > test.tsv
-N tells it not to print column headers. -B is "batch mode", and uses tabs to separate fields. NULL is replaced by space.
For 100 GB databases , this may help-
mysql -uroot -proot -h "mysql.host.url" -N -B -e "select * from world.city" > test.tsv
sed 's/NULL/ /g' < test.tsv > new.tsv
But i recommend For huge databases you should use ETL Tools.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With