In this article, we will show you how to migrate your customers’ databases into your reseller hosting account. At this point, you should have already created a cPanel account. These steps will also work on the VPS reseller program as well as the shared option.
How Do I Know if my Customers are using a Database?
If your customer is using a Content Management System like WordPress or Joomla, or they have a shopping cart, then they are most likely using a database to store the content of their website.
Repairing the Database
It is important to always “repair” the database before exporting. Often, exporting a database without using “repair” can cause data loss due to caching and various server-side functions.
How to Repair a Database in phpMyAdmin
phpMyAdmin is a popular open-source database management system. It is widely used, so your customers may have an available installation in their hosting environment. Here we’ll show you how to access phpMyAdmin from the cPanel interface.
- Log into your cPanel.
- Click on phpMyAdmin located under the Databases category.
- Select the database you want to repair from the menu on the left side.
- Under the Table section choose Check All.
- In the dropdown menu, select Repair table.
How to Repair a Database from the Command Line
If your customer does not have either cPanel or phpMyAdmin, you can also repair the database on the command line using the below command:
mysqlcheck --repair -u [USERNAME] -p [DATABASE]
Make sure to replace [USERNAME] with the actual database username and [DATABASE] with the name of the database.
Exporting the Database
You will need a copy of the database in .sql format. Your customer should be able to provide this to you. If not, there are a few different ways they can export their database.
You can export a database using phpMyAdmin if available. You can also export the database on the command line.
Import the Database into Your Reseller Server
Once you have recovered the .sql file from the old host you can easily import the database into your customer’s phpMyAdmin installation (available through cPanel).
How to Import the Database into phpMyAdmin
The steps below are meant to be followed after you have created a new database to import the original database into.
- Log into cPanel.
- Go to the Databases section.
- Choose phpMyAdmin.
- Select the database you created to import into.
- Click Import from the top menu.
- Under File to Import click Browse.
- Locate the database file you are importing.
Click Go at the bottom.
Now that you have imported the database, make sure that any applications that use this database can connect successfully. Remember, you can test the site with a hosts file modification before switching DNS to your reseller server.
If you are working on migrating an account from a non-cPanel host, you can continue to our next article on transferring emails to your reseller account.