magento-tutorials

How to Repair a Magento Database

Posted on April 16, 2011 · Posted in Magento Bug Fixes

There are many instances, where your Magento database can get corrupt and you will start getting a lot of errors on your Magento installation.

And its a bad idea to waste days and days trying to fix the database yourself, because you may end up with a completely broken website.

So, here is a workaround :

Magento Core Team has gave a nice database repair tool, which helps a big time.

You can download it here.

And now the step by step method :

  1. Download and unzip the Database Repair Tool . You will get a php file. Just place the php file somewhere on your server, so you can access it on browser.
  2. EXPORT your current database and make sure, you check the option, “DISABLE FOREIGN KEY CHECKS”
  3. Import the exported database from Step 2 to a new database.
  4. Install Magento latest version on a new database.
  5. Now open the repair tool php file on your browser.
  6. It will ask for database credentials for the CORRUPT DATABASE and REFERENCE DATABASE.
  7. Just enter the database details from Step 3 , to the CORRUPT DATABASE field.
  8. Enter the newly installed magento database details from Step 4 , to the REFERENCE DATABASE field.
  9. Click SUBMIT and wait for the success page.
  10. This will fix all of your database errors and all from your database and make it ready.
  11. Now, goto your own website ‘s folder, var/cache and delete all the folders inside it.
  12. Goto app/etc/local.xml and edit the database name and make it to the new database, which was done in Step 2.
  13. Access your website on browser now.
  14. You are done.