There are two quick ways to restore a MySQL from the database dump. Follow the step-by-step instruction below
1. Using Command-Line
Step 1: Create A New Database
On the system that hosts the database, use MySQL to create a new database.
Make sure you’ve named it the same as the database you lost. This creates the foundation file that MySQL dump will import the data into. Since the dump file has the commands to rebuild the database, you only need to create the empty database.
Step 2: Restore MySQL Dump
To restore a MySQL backup, enter:
mysql -u [user] -p [database_name] < [filename].sql
Make sure to include [database_name] and [filename] in the path.
It’s likely that on the host machine, [database_name] can be in a root directory, so you may not need to add the path. Make sure that you specify the exact path for the dump file you’re restoring, including the server name (if needed).
2. Using phpMyAdmin
If you’re running phpMyAdmin backing up, restoring your MySQL database is simple. In phpMyAdmin, the Import tool is used to restore a database.
- On the menu across the top, click Import.
- The first section is labeled File to import. A couple of lines down, there’s a line that starts with “Browse your computer,” with a button labeled Choose File. Click that button.
- Use the dialog box to navigate to the location where you’ve saved the export file that you want to restore. Leave all the options set to default. (If you created your backup with different options, you can select those here.)
- Click Go.
In case you have any other questions, please reach out to us via: