Below we are going to show how you can easily restore your database from backup. MySQL database restoration process consists of two steps if you use Command Prompt, first, you need to create a new MySQL database and then restore a database. Or you can simply use SQLBackupAndFTP restore job.
How to restore MySQL Server backup via Command Prompt
One more crucial point we want to mention here is that it’s really important to make sure that that database to which you are going to restore a dump file is empty. It’s highly recommended to create a new database or if there is no opportunity to do it – delete all data and tables from the existing one. If you ignore that point, you’ll face duplicate data which will bring database corruption in the future.
Create a new database
To create a new MySQL Server database using cmd go through the following steps:
- Run MySQL Client utility
C:\>cd "C:\Program Files\MySQL\MySQL Server 8.0\bin" C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p<root_password>
- Create a database
create database mydatabase;
That’s all we have just created the new database MyDatabase. Now let’s restore the backup.
Restore the database from the backup file
To restore the backup (dump.sql) to the new database (mydatabase) use the following command:
mysql -u root -p<root_password> mydatabase < "C:\Users\Admin\Desktop\dump.sql"
That’s it, the backup file is successfully restored.
How to restore MySQL Server backup via SQLBackupAndFTP
- Create a “Restore Job”
- Choose a destination where your backup is stored
- Connect to MySQL Server to which the backups should be restored
- To run the restore process click on the “Run Now” button
These are the basic steps that allow you to restore the backup, also you can set an email notification or set to restore the backup to a new database.