How To

How to Restore a MySQL Database

Member
By BlueOx
User-Submitted Article
(1 Ratings)
Restore a MySQL Database
Restore a MySQL Database

There are a number of reasons why you may need to restore your MySQL database. Perhaps you performed an upgrade on the scripts that power your site, only to discover that the upgrade corrupted your MySQL database. Perhaps you are moving your site to a new server and simply need to add a copy of your database to the new server. Or, perhaps someone with ill intent has gained access to your server and played around with the structure of your MySQL database. These databases are actually very easy to restore as long as you have made a backup of your database before the problem occurred.

Difficulty: Moderately Easy
Instructions

Things You'll Need:

  • Backup copy of the database to be restored
  1. Step 1

    Log into your control panel at the web host and look for the link to create a MySQL database. Create a new MySQL database. If possible, use the same database name, user name and password as your old database. If you are unable to do this, you will need to update the configuration file on the scripts that power your site, so that it points to the new database. This file is usually named config.php.

  2. Step 2

    Return to the main page of the control panel after you have created a new database. This time you are going to look for the link that says PhpMyAdmin. Click this link to enter the administration area for your MySQL databases.

  3. Step 3

    Know that when you enter phpMyAdmin, the left side of the screen will show a list of MySQL databases that are on your server. Locate the one with the name of the new database you just created. Note that the database has (0) at the end, since there are not yet any tables or other information in the database. Click the name of the database to open the administration area for this database.

  4. Step 4

    Consider that once you enter the administration area for your new MySQL database, look for the tab that says "Import". Click this tab so that you can import the backup copy of your old MySQL database.

  5. Step 5

    Know that on the import menu, you have two options. You can either browse to a backup file, or manually run MySQL queries to import the data. Since you have (hopefully) been wise enough to make backups of your database on a regular basis, we will click the browse button and surf to the backup file, then click "Go".

  6. Step 6

    Be aware that after the import is complete, a message will be loaded to confirm that the queries have been executed. Now look at the left side of the screen. You will notice that there are no longer 0 database tables and that information is now present. Congratulations. You have successfully restored your MySQL database.

Tips & Warnings
  • Restoring the database is easy. The key is to make a backup copy of your database on a regular basis. Remember the first rule of computing--save early, save often.
Resources

Post a Comment

Post a Comment
  • Have you done this? Click here to let us know.
I Did This

Related Ads

Computers
Alexia Petrakos,

Meet Alexia Petrakos eHow's Computers Expert.

Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US

eHow Computers
eHow_eHow Technology and Electronics