Mysql restore database from dump file with GZIP compression
Posted by in MySQL March 6, 2011 1 Comment

To restore your mysql database from dump file, specially with large backup file, you should do it from shell command in unix/linux or command prompt in Windows by using mysql command.

1. Restore mysql database from dump sql file

mysql -u root -p your_database_name < your_dump_file.sql

2. Restore mysql database from dump sql file with GZIP compression

gunzip < your_dump_file.sql | mysql -u root -p your_database_name

The command above assumes that you would to restore a database named “your_database_name” from a backup sql dump file named: “your_dump_file.sql” with Mysql root account.

Note: you should be asked to enter your mysql account password, once you enter the password just key in your database password and you are done after minutes :)

If you need to know how to backup your mysql database, read this post.

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at hoan@4rapiddev.com