Sure:
mysqldump db_name tbl_name -d | bzip2 -c | nc -l 1234
and
nc 101010.114 1234 | bzip2 -cd | mysql -uroot -proot@123 test
(Replace bzip2
with gzip
or some other compression program if you want; they all work much the same way in Linux)
There's no reason to use tar; you're just dumping data out of MySQL as a single chunk of text. You're also using nc
in what is generally considered a "backwards" way; typically the consumer of the data (mysql
in this case) does the listening (but there's no actual difference in operation, it just "feels" weird).
Be warned, though, this method might not actually make anything go faster -- in my experience, the bottleneck in MySQL dumps/loads is MySQL, not the network (unless you're running this over a seriously bandwidth-constrained link).