How do I restore a MySQL dump?

If you have an all-database MySQL dump, follow the instructions below to restore your SQL file with all database data & privileges.

Please note that the following procedures require command line access and is assuming you are the administrator of the computer.

Step 1:
Open up command line.
Start > Run > Type ‘cmd’ > Enter

Step 2:
Change directory to your MySQL bin folder. This can be C:Program FilesMySQLMySQL 4.1 Serverbin — or C:xamppmysqlbin depending on what your setup is like. You can do so by the ‘cd’ command as follows:

cd C:xamppmysqlbin

Step 3:
Ensure that you have moved your backup file (eg: db_backup.sql) into the bin folder and run the following command where test is an empty MySQL database.

mysql -u root -p test < db_backup.sql

It will prompt you for your root password. Enter that and it will start importing your SQL file. It can take several minutes depending on how big your SQL file is.

Good luck!

Leave a Reply

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