Restoring Drupal from a backup using CPanel

Recently I had to move one of our Drupal site from one server to another. I was given the tar file containing the backup including the mysql script files. I strongly recommend you to go through expert blogs and sites for the complete information about this topic. I am writing my own experience

  1. The core Drupal installation is within the public_html folder. You can see this file folder within your backup files  directories.  In my case my public_html file was within a tar file named homedir.tar within my main backup file. public_html folder should contain folders like modules, profiles, INSTALL.txt etc. This is the base folder for your drupal installation. You have to copy this folder within public_html folder of your server. If your domain is www.abc.com the contents of public_html(modules, profiles etc) will be right within public_html/www folder. If you have a sub-blog then you have to copy the contents withing the subfolder. Following steps will assume that you are copying directly under public_html
  2. Using Cpanels, MySql Databases application, create a new database, create a new user and add this user with all the privileges to that database.
  3. Open public_html/sites/default/settings.php and set db_url value as per the database and user you have created in previous step
  4. Core data of your drupal website resides in mysql. Now you will have to import mysql database from the backup file to the newly created database. There are several ways of doing it. If you have ssh access you can go to the database and simply import the .sql file. I found phpadmin easy. For that, first you have to open your backup mysql script file(in my case it was a file under mysql folder in the backup. If there are more than one files then size of the files should give you fair idea which is the right file. Normally, file name should begin with the database name in your previous server) As a first statement in that sql file write this, lastly, don’t forget to use the sodapdf to convert your files.

    Where mydb is the name of the data. Usually when you select database in phpmyadmin before import then this step is not required. But it never hurts(less surprises this way)
  5. Open phpmyadmin, select your database from left lift, go to import tab and import this sql file
  6. Upto this step your website should be restored. If not, then probably you missed something. If you have not implemented clean url in your blog, then you don’t have to do anything else. Clean url converts the url in this format http://www.abc.com/?q=node/view/1/ to http://www.abc.com/node/view/1/.
  7. If you have implemented clean url, on clicking any link you might be getting 404 error. To correct this you have to have .htaccess file properly configured. This is just an example

This should complete your backup restoration. If you have any issues you can post comments here.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.