Education ChannelsWHM

Merge multiple cPanel accounts into one account using SSH

This article aims to introduce a more advanced technique for consolidating multiple cPanel accounts into a single one. This method is particularly useful for those who are contemplating switching to shared hosting or want the convenience of managing multiple sites from a single cPanel account. However, it’s important to note that having multiple cPanel accounts is only possible with VPS or dedicated server plans.

For the purpose of this tutorial, let’s assume that we have two cPanel accounts – userna1 with the domain name and userna2 with the domain name Our goal is to merge the domain into the userna1 cPanel account, enabling both domains to be managed using a single login.

To accomplish this, we must first obtain a copy of the MySQL database associated with the site. Additionally, we need to update the database credentials in any scripts after transferring the files to the userna1 account, given that the site is built on WordPress.

It’s worth noting that the creation of cPanel is no longer unlimited. For more information on cPanel pricing changes and related FAQs, please refer to the official website.

It’s essential to have root access to your server to follow these steps. If you don’t have root access, we recommend that you review our basic guide on merging multiple cPanel accounts into a single one.

  1. Login to your server via SSH as the root user.
  2. You’ll want to find the document root for our domain then change to that directory with these commands: <code”>grep /etc/userdatadomains </code”>Which should give change to the directory in-between the ==’s with:cd /home/userna2/public_html
  3. Next we’ll want to look for any database configuration files. This can be accomplished by looking for the username followed by an underscore _ using the following command: grep userna2_ . -RHWhich should spit back:./wp-config.php:define('DB_NAME', 'userna2_wrdp1');
    ./wp-config.php:define('DB_USER', 'userna2_wrdp1');
    Now we can see because this is using a wp-config.php script that these are the database credentials for a WordPress site. You’ll want to open up this file with your favorite text-editor and copy down the values for DB_NAMEDB_USER, and DB_PASSWORD for use later.
  4. Now that we know the database name we can backup that database using the following command: mysqldump userna2_wrdp1 > ~userna2/userna2_wrdp1.sql
  5. Now you’ll want to start copying over all of the data from the userna2 account to the userna1 account using the following commands: cp -frp ~userna2/etc/ ~userna1/etc/cp -frp ~userna2/mail/ ~userna1/mail/cp -frp ~userna2/mail/.*@addondomain_com ~userna1/mail/cp -frp ~userna2/public_html ~userna1/public_html/
  6. Next we’ll want to temporarily modify our domain so that we can add it to our userna1 cPanel account. To do this log into WHM.
  7. In the top-left Find box type in modify, then click on Modify an Account.
  8. Select, then click on Modify.
  9. In the Primary Domain: field add a suffix to your domain, so in this case we use Then scroll to the bottom and click on Save.
  10. Still in WHM in the top-left Find box type in List, and then click on List Accounts.
  11. Now click on the cPanel icon for the account with the username userna1.
  12. Under the Domains section, click on Addon Domains.
  13. Now type in as the new domain name, and choose a FTP username and document root for the site as well then click on Add Domain.
  14. Now that you have all of your website data loaded under the userna1 cPanel account the next thing you need to do is restore your MySQL database that you backed up. To do this login to your cPanel with the userna1 username.
  15. Under the Databases section click on MySQL Database Wizard.
  16. Now in this case I already know the userna1 user has one WordPress site and database already, so I’ll be naming my database userna1_wrdp2, then click on Next Step.
  17. I’m also going to set my database username to userna1_wrdp2, give that user a password then click on Create User.
  18. Finally on the last step of the database wizard, click on ALL PRIVILEGES to check everything, then click on Next Step.
  19. Now back in your SSH session you can import the MySQL database backup using the following command: mysql -u userna1_wrdp1 -p userna1_wrdp1 < ~userna2/userna2_wrdp1.sqlAt the Enter password: prompt enter in the password that you copied down earlier.
  20. Now we want to correct all of the ownership permissions for the userna1 user using the following command: fixperms userna1
  21. Now that you have your website data copied over, and the MySQL database imported you’ll want to modify your database credentials in the ~userna1/public_html/ script or any other database configuration scripts you found to use the userna1 cPanel username instead of the userna2 one. That way when you get rid of the userna2 account the database will continue to function as its own separate entity.
  22. Finally you can log into WHM once more to remove the old standalone userna2 account.
  23. In the top-left Find box, type in terminate, then click on Terminate an Account.
  24. Click on the domain, then click on Terminate at the bottom of the page.

If you followed all of those steps you should have now successfully merged your site from the userna2 cPanel account, into the userna1 one. You could simply keep repeating this process again and again to get multiple cPanel accounts all merged down into one.



Leave a comment

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