How to Restore a Web Hosted Database from a Backup

Restoring a web hosted database from a backup can be one of the most nerve-racking and risky tasks you can undertake as a website owner. Use the following two simple rules, though, and it will be a lot less stressful and intimidating:

  • Remember to make a backup of your database before doing anything to it.

    The database may have corruption or may be causing issues of some kind, but, if possible, always make a backup of what is there, just in case you need it later.

  • After you have made a backup, remove any tables that you are going to restore. You can do this using the Drop command.

    MySQL will not just overwrite data in a table; it will attempt to append the new data to the end of the table, meaning you can end up with duplicated data and a bigger mess than when you started.

    Do not just empty the table because the issue may be in the structure of the table itself. Drop the table completely so it is completely re-created when you do the restore.

After you’ve done these two things, you will have the peace of mind that you have a backup of the original data, or what’s left of it, and a have created a clean, empty space to upload into.

Restoring from a backup is simply the reverse of creating a backup.

How to restore a backup using phpMyAdmin

Use the following steps to restore a backup using phpMyAdmin:

  1. Open phpMyAdmin.

  2. Select the database you want to restore to.

  3. Click on the Insert tab.

  4. Select the file you want to restore from by clicking Choose File.

  5. Click Go.

All tables in the file you selected are restored to the database. If you have not dropped all the tables you are restoring, the restore may fail with an error due to duplicate records being created.

How to restore a backup using MySQL Workbench

Use the following steps to restore a backup using MySQL Workbench:

  1. Open MySQL Workbench.

  2. Under Server Administration, click the server you wish to restore to.

  3. On the right column, click Data Import/Restore.

  4. Select whether to import from a dump folder or self-contained file, depending on how you backed it up.

  5. Browse to the file you want to restore from and select it.

  6. Click Start Import.

It is important to make regular backups of your database so that if you do ever have to restore from the latest backup, the amount of data lost is minimized.

blog comments powered by Disqus
Advertisement

Inside Dummies.com