How to Migrate a Drupal Site From a Web Host to Another?

Drupal Site MigrationHere are detailed guidelines how to migrate a Drupal website from a web host to another. Following the careful steps, webmasters even a newbie can achieve the process quickly and easily.

People are always required to move their websites from one host to another, because of the slow speed, frequent downtimes, poor support, in-affordability and other reasons. As many people get stocked in the process and send email to our editors for helps, we just come out this tutorial with clear explanations, detailed steps, and vivid illustrations so that all readers can successfully move their websites.

Preparations

First of all, I suggest you do the following preparations so that you can go through the following steps smoothly.

  • Before migrating Drupal website, check for any new Drupal core, module and template updates. If there are modules or templates needed to be updated, just do the update before moving.
  • Find a reliable Drupal host to power your new website. In order to avoid the next migration, you need to select a truly reliable and cost effective Drupal web hosting solution for your website.
  • Check your versions of PHP and MySQL on the new and current host. If you are running different versions of PHP and/or MySQL on your new and old servers, be sure to check for any incompatibilities with your modules.
  • Backup your old website in case there are any problems later and you can restore it as soon as possible.

Migrating Drupal Website on Old Host

  1. Backup and download the whole home directory of your old website.
  2. Open up your FTP client and go to the root, and we use Filezilla to make it in the example. Find the home-directory and download the complete directory to a local folder. Note that remember the name and place it is stored so that you can find it when upload.

  3. Backup and download MySQL database on the old host.
  4. Log into your server control panel (it is generally a cPanel), find phpMyAdmin in Database section.

    phpMyAdmin icon

    Click to open it and find your Drupal website database like “name_drupal”. Select all fields, or check the bottom Check All checkbox. And then click the Export on the top navigation bar.

    export database

    When store the file, you are required to choose the Export Method and Format, just select the Quick Export and save the file as SQL format.

    save database

Import Drupal Website on New Host

You have export all your website files from the old website, and it’s time to import them into the new host.

  1. Upload the home-directory folder to the new server.
  2. Just as the inverse process of export, you can open up a FTP account via a client and upload the folder to the new server.

  3. Create a new MySQL database and user.
  4. Before importing the database, you have to create a new database with the same name and user. So just go to cPanel – > MySQL Database, click and log into it. Under the Create a New Database, enter a name for your Drupal database then click the Create Database button at last.

    Create a New Database

    Scroll down to the MySQL Users section, and you can see the MySQL User create a new user. Enter the username and password, and click the Create User button so you can simply create a user.

    create MySQL user

    Now, you need to add the new user to the database. Scroll down to the Add User To Database, select the database and username you created before, then click the Add button.

    Add User to Database

    At last, you should also grant permission to the user. Under the Manage User Privileges to give user total access to the database, and then click Make Changes to complete the operation.

    Manage user Privileges

  5. Import the database into the new host.
  6. Log into the new host phpMyAdmin, select the database you created in the last step, and then click the Import on the top navigation bar. Browse the database backup in the local computer, and click Go button at last. This process will take some time, and the detailed time is depended by your file size.

    import database

  7. Modify the Database Settings
  8. Modify the database settings at [Drupal-home] /sites/default/settings.php and change the database, location, username and password to match new database information. You can also enter the password either encrypted or not there.

    /** The name of the database for Drupal */
    define('DB_NAME', 'cpuser_dbname');
    /** MySQL database username */
    define('DB_USER', 'cpuser_uname');
    /** MySQL database password */
    define('DB_PASSWORD', '******');
     /** MySQL hostname */
    define('DB_HOST', 'localhost');
    
  9. Change the DNS Settings
  10. Login into the control panel of your domain registrar and modify the A record. Point your domain name to the new IP of your website.

At present, the migrations have all been completed. We still suggest you redirect all the old links to the new website so that you can keep your visitors as well.