Take the 2-minute tour ×

I have a ".SQL" file which contains data at a remote server. I could download that file to my local machine and import data in my local DB, but because of network issues, and the size of ".sql" file (6.7GB) it's taking forever.

Is there any way I could execute the restore command on remote server and tunnel the output to my local machine DB ?

Thanks for help !

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You should gzip the file.

gzip DataFile.sql

Then, download it to the local machine.

Once it is on the local machine, run the following:

gzip -d < DataFile.sql.gz | mysql -uroot -p... ...

If you would rather import through the tunnel, try this on the remote server:

mysql -h<IP of your machine> -uroot -p... < DataFile.sql

If you local Linux machine has a firewall, run this

service iptables stop

then run the import. Finally, run this on your local box and put up the firewall

service iptables start
share|improve this answer
is there no way i can execute mysql -uroot -p < sql.sql and tunnel the out put to my local machine ? –  vinny May 1 '12 at 19:50

SO question with the remote command. The bottleneck is related to your network speed. Forever is slightly too long. Due to the size, try and compress the file remotely and then download it.

share|improve this answer

Your Answer


