I can import data.sql onto my foreign host with this command:

mysql -u username -p -h foreign-host.example.org -A DATA-BASE-NAME < data.sql

Which works fine for small export files, but I cannot find an explanation how to import a large file, so the transfer will be compressed.

2 Answers 2


Use the --compress flag.

mysql --compress -u username ...

--compress, -C

Compress all information sent between the client and the server if both support compression.


Virtually any MySQL client and server will support compression.


You can use gunzip:


gunzip < path_to_gzippedfile | mysql -u username -p -h hostname database_name.

  • but that would not send it compressed, which was the question
    – rubo77
    Nov 8, 2015 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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