Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.