As WordPress is one of the most popular web publishing platforms and cPanel is an extremely popular hosting platform, moving a site built on these platforms is a task many web site developers or owners will likely need to do. The good news is that it is quite simple to transfer a WordPress site between two cPanel hosting accounts using only the tools provided within cPanel.

In this guide, we will refer to the server on which the site is initially hosted as the source server, and the new hosting account’s server as the destination server. We’ll look at the step-by-step process and highlight any snags that may be encountered. We’ll assume a basic knowledge of how to access cPanel and its tools, that the installation is a single WordPress site with a standard configuration, and that the site remains on the same domain name once transferred.

Although cPanel provides a backup tool, we will focus on simply moving a website using File Manager and phpMyAdmin to minimise the size of the files required for transfer – this is not a guide to transferring an entire cPanel account. That’s for another tutorial.

Source server – create a backup of files and database

  1. Log in to cPanel on the source server.
  2. Click on File Manager.
  3. Enter the public_html directory.
  4. Click Select All on the toolbar.
  5. Click Compress on the toolbar or right click and choose Compress.
  6. In the Compress dialogue box:
    1. Compression Type: choose GZipped Tar archive for optimal file size.
    2. Enter the name…: enter a suitable name, e.g mysite.tar.gz.
    3. Click Compress
  7. Wait for the compression process to complete, then select your compressed file (e.g. mysite.tar.gz) and click Download on the toolbar. Save the file to a convenient location on your computer.
  8. While still in File Manager, make a note of the WordPress site’s database name, as follows:
    1. In public_html, highlight wp-config.php and click Edit on the toolbar.
    2. Note the database name from the value of DB_NAME, e.g.:
      define('DB_NAME', 'mysitename_db1');
  9. Close File Manager.
  10. On the main cPanel page, under Databases, click phpMyAdmin.
  11. On the left menu, click the name of the database for your WordPress site as noted above.
  12. Click Export and select:
    1. Export method: Quick (acceptable for most standard WordPress installations)
    2. Format: SQL
    3. Click Go
  13. The SQL file will be saved to your Downloads folder, or default download destination.

NB you can also export the database from the Files > Backups section of cPanel but I find it better to use the above so the database can be checked in detail before export.

Destination server – prepare a new database, upload files and import SQL to a new database

  1. Log in to cPanel on the destination server.
  2. Under databases, click on MySQL Database Wizard to create a new database. Have a text file open and ready so you can note all the credentials created: database name, username and password.
    1. Step 1: Create database – enter a name.
      1. Note: cPanel will likely prepend it with the cPanel account's user name so you may not be able to use the same name as the database from the source server.
    2. Step 2: Create Database Users – enter a username and password.
    3. Step 3: Add user to the database – check the box beside ALL PRIVELEGES and click Make Changes.
  3. From the main cPanel screen, again under databases, click phpMyAdmin.
  4. On the left menu, click the name of the database created in the Step 1 above. This must be an empty database otherwise it will be overwritten – to verify, click the Plus icon beside the database name to expand any tables. If tables exist, verify the database name from the MySQL Databases screen (cPanel main page > Databases > My SQL Databases).
  5. Click import:
    1. Under File to import: click Choose File and find and select the SQL file created in step 12 of the Source Server Instructions.
    2. Accept the default values for other settings.
    3. Click Go.
  6. Click on File Manager.
  7. Enter the public_html directory.
    1. If files exist, backup any existing files or move them to a separate directory. The import will overwrite any existing files with the same name. I recommend renaming the existing public_html directory and creating a new public_html directory to avoid any conflict.
    2. If there are no files, proceed as follows.
  8. Click Upload on the toolbar.
  9. Find the tar.gz archive created in step 6 of the Source Server instructions and upload this file.
  10. Go back to the public_html directory, select the tar.gz file and choose Extract. Accept the default settings.
  11. Once the extraction is completed, edit and save wp-config.php, as follows:
    1. replace the values of the following variables (values given as examples only) with the database details noted in step 2 of these Destination server instructions:
      1. DB_NAME e.g. define('DB_NAME', 'mysite_db1');
      2. DB_USER e.g. define('DB_USER', 'mysite_dbu1');
      3. DB_PASSWORD e.g. define('DB_PASSWORD', 'mysecuredbpassword');
    2. Additionally, you may need to edit DB_HOST, depending on server set up. Typical values are:
      define('DB_HOST', 'localhost');
      define('DB_HOST', '127.0.0.1');
    3. Some hosting companies may assign different values for DB_HOST; check with your hosting provider if a database connection cannot be established with either of these values.
  12. Now test the front end of the site and test the log in, which will be at https://yourdomain.com/wp-login.php.
    1. Test with hosts file: edit your hosts file to point the domain to the new server.
    2. Make it live: point the domain to your new server by transferring the domain and updating the A record, or simply update the A records where it is presently hosted.
    3. Troubleshooting: the most common issue is the database connection – check the details are entered correctly in wp-config.php and double check the value of DB_HOST.

Further reading

The official cPanel documentation on migrating WordPress

Was this answer helpful? 0 Users Found This Useful (1 Votes)