In order to transfer your Drupal website to a new hosting, you will need to transfer its files and database.. 

Prerequisits

On a server — root (admin level) access, Linux/Windows Apache, MySQL and PHP.

On a hosting — admin panel or access via SSH.

Creating a database backup

Before you create a backup, you will need to clear Drupal’s cache. In order to do this:

  1. Log into Drupal’s admin panel
  2. In the top menu click on Configuration/Development/Performance.
  3. Click on Clear all caches.

You can backup the database through phpMyAdmin. Alternatively, you can do this via a console. We will provide instructions for both scenarios.

Backing the database up via phpMyAdmin

  1. Log into your admin panel
  2. Go to phpMyAdmin menu.
    phpMyAdmin
  3. Choose the necessary database on the left. You will see a list of tables to the right.
    replace
  4. Click Export. This will open a new page.
  5. Click Go and save the file.
    export-db02

Backing the database up via console on Linux

  1. In order to back up the database via console, enter the following command into the terminal:
    mysql -u user_name -p user_password database_name > path/and/file_name_for_backup.sql
  2. Press Enter.

Backing the database up via console on Linux (Drush)

  1. If you have Drush installed, enter the following command into the terminal:
    drush sql-dump > path/and/file_name_for_backup.sql
  2. Press Enter.

Backing the database up via console on Windows

  1. Open the command prompt (Win+R, or Start/Accessories/Command prompt).
  2. Using the command prompt, go to the folder where you have MySQL installed. To do this, enter:
    cd Path/to/MySQL/installation/folder
  3. Press Enter.
  4. Go to the folder with executable files. To do this, enter:
    cd bin
  5. Press Enter.
  6. Save the backup into the file. In order to do this, enter:
    mysqldump.exe -e -u user_name -p user_password database_name > path/and/file_name_for_backup.sql
  7. Press Enter.

Transferring the website’s files

After you have the database backed up, you need to transfer the website’s files to a new hosting. In order to do this, you need to archive them. Transferring an archive is faster and more safe than transferring each files separately.

After you have downloaded the website’s archive, upload it to our hosting and unpack it.

Importing the database backup

Before you import a backup, you need to create a database. If you need instructions:

After you have created a database, you need to import the backup. You can do this via both admin panel and console.

Importing the backup via phpMyAdmin

  1. Log into the admin panel.
  2. Go to phpMyAdmin menu.
    phpMyAdmin
  3. On the left, select your database.
    import-db
  4. Click on Import.
  5. In the File to import field, select a file with a backup you made earlier.
    import-db2
  6. Uncheck Partial Import.
  7. Set the import format to be SQL.
  8. Click Go.

Importing backup via console on Linux

  1. Enter the command into the terminal:
    mysql -u user_name -p user_password database_name < path/to/a/file_with_backup.sql
  2. Press Enter.

Alternatively, you can use a following set of commands:

mysql -u user_name -p user_password database_nameх
use database_name
source path/to/a/file_with_backup.sql

Importing a backup via a console on Linux (Drush)

Only the backups that were created in Drush can be imported through it.
After Drush is setup, the settings.php file already has to contain the permissions on database access and its name, while the database itself must be empty.

Importing backup via console on Windows

  1. Open the command prompt (Win+R, or Start/Accessories/Command prompt).
  2. Using the command prompt, go to the folder where you have MySQL installed. To do this, enter:
    cd Path/to/MySQL/installation/folder
  3. Press Enter.
  4. Go to the folder with executable files. To do this, enter:
    cd bin
    cd bin
  5. Press Enter.
  6. Import the database. In order to do this, enter into the command prompt:
    mysqldump.exe -e -u user_name -p user_password database_name < path/to/a/file_with_backup.sql
  7. Press Enter.

If you are transferring your website to Unihost hosting — we are offering a free transfer service. Just notify our tech support that you want to transfer a website and we will do it for you.