tags:

views:

26

answers:

2

I can copy the records from one server to another using the following command.

mysqldump -hlocalhost -uroot -pPassWord db tbl_name | 
        mysql -h100.100.100.100 -uroot -pPassword other_db tbl_name

But is it possible to zip it up while sending the data? for e.g.

mysqldump -hlocalhost -uroot -pPassWord db tbl_name | 
        gzip -cf | gunzip -c | 
        mysql -h100.100.100.100 -uroot -pPassword other_db tbl_name

and extract it on the other server to be executed using mysql command?

+2  A: 

Yes here's blog post that shows you how

DroidIn.net
A: 

You can compress the data while transferring it, but not within the mysqldump command. You have to transfer the compressed data in an explicit step, e.g.:

mysqldump -hlocalhost -uroot -pPassWord db tbl_name | gzip |
   ssh 100.100.100.100 "gunzip | mysql -hlocalhost -uroot -pPassWord db tbl_name"
tangens