Restoring a Drupal MySQL Database using phpmyadmin

If you have used the Backup module on Drupal to backup up your site, then inside to the tar.gz file which contains all the web files, there will also be a slq.gz file which is a compressed version of your database.

One way to import this is using phpmyadmin. Simple go to the database you have created, and chose import, speificy the file, and hit “go”. However, there are often problems with phpmyadmin when importing larger files, i.e. it fails. If the import is successful, then it should report something like:

Import has been successfully finished, 630 queries executed.

However it has been known that for some larger files for php to fail. One thing that is often required is to increase the maximum upload file size in the php.ini configuration file. I have set my php upload file size to 26Mb, which is currently enough still; the last database that I uploaded using phpmyadmin was less than 2Mb. However, some popular, older site can have very large databases. For these, it may be better to use the mysql command line to import. I will go further into that later, once I have mastered the process myself.

For now, assuming that you have successfully inported the Drupal database using phpmyadmin, you should now have a copy of your Drupal installation. With this. you can install new modules, test, play, and upgrade, all without risk to harming your live version.

The main reason that I set out to make a copy of my Drupal installation was to then upgrade it, and check everything is working. There have been security warnings regarding older version of Drupal (5.2 is prone to MySQL attacks) and therefore I want to upgrade to 5.7. However, I did this for a new site (I actually built it using an old 5.2 download, then upgraded) but the forums failed to work afterwards. Something to do with MySQL settings / tables. I cannot afford my forums to die on my main Drupal site, so therefore, I need to practice too.

In the meantime, it is nice to know that I have a method to totally renew my Drupal installation incase of hackers bringing the site down. Sometimes once a hacker has got their hands on you database it is not easy, or even impossible, to fix. Often the only option is to drop the database and rebuild from backup., so ensure no other rogue code is hiding, causing havoc.

4 Comments on “Restoring a Drupal MySQL Database using phpmyadmin”

  1. Sir ,i am very very new to drupal.I need to take the drupal site Backup and restor from one system( Office )to other system (House)

    i am using WAMP server.i am taking backup using “BACKUP and MIGRATE” Module

    when coming to restore i am restoring it using php MyAdmin import(field)

    mysite displaying ok but when i click on menu(other than home) it displaying WAMP HOME PAGE.

    Plese help me sir, i am struggling since 15 days.


  2. very very new to drupal.i am using ” IMPORT & MIGRATE ” module i am taking backup using it.

    when IMPORT DATABAS TO OTHER SYSTEM” using” PHP My_Admin “,Showing import has been sucessfull displaying site.When i click on menus (other than home) It displaying WAMP HOME PAGE.

    Sir iam facing this problem since 15 days .Let me know the solution.
    Thank you.

  3. Sorry, I have only used LAMP, and to a limited extent. Not really developed with Drupal for a couple of years now.

    Have you tried just migrating the files and the database separately?

  4. yes sir I am migrating the files and the database separately? One more thing to say sir,
    When I restore the same database with different database name in the same system it is working fine.

Leave a Reply

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