How to import a compressed mysql file .sql.gz using linux shell?

Login into your server using a shell program like putty.

Type in the following command on the command line

zcat DB_File_Name.sql.gz | mysql -u username -p Target_DB_Name


DB_File_Name.sql.gz = full path of the sql.gz file to be imported

username = your mysql username

Target_DB_Name = database name where you want to import the database

When you hit enter in the command line, it will prompt for password. Enter your MySQL password.

You are done!

This entry was posted in MySQL. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *