How to restore MySQL database from mysqldump backup

On my previous tutorial, I have shown how to backup MySQL databases using mysqldump command. mysqldump is a handy backup and restore tool for MySQL Server. Here I want to show you  how to restore the MySQL databases from the backup.

In order to restore the MySQL databases, make sure you have root access to the MySQL server. Or at least you are the user that has privileges to backup and restore MySQL. Second thing is to make sure you have the backup file in hand.


  • MySQL Username: root
  • MySQL Password: 12345
  • Backup file name: backup20160504.sql.gz

To restore from the backup file, execute this command on Terminal console:

gunzip < backup20160504.sql.gz | mysql -u root -p12345

Please note that there is no space after -p. The command will restore all the databases from the backup file.


Leave a Reply

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