To migrate a WordPress site, follow the steps below:
Exporting the mySQL database
1. You will need to know the name of the database, which can be found in your wp-config.php file. Locate the lines shown below:
/* MySQL settings */
define( âDB_NAMEâ, âdatabase_nameâ );
define( âDB_USERâ, âusername_hereâ );
define( âDB_PASSWORDâ, âpassword_hereâ );
define( âDB_HOSTâ, âlocalhostâ );
define( âDB_CHARSETâ, âutf8â );
database_name will be the database name. The format will always be with your cPanel username_databasename
2. From inside of cPanel, navigate to phpMyAdmin.
3. Once inside of phpMyAdmin, click on your database located on the left side. Note: If you have multiple databases, you will see the option to expand your username using the + symbol.
4. Once clicked on your database to migrate, youâll see all of the tables shown in the right pane. At the top, youâll click âExportâ.
5. After clicking export, youâll see a radio button selected for âquickâ â if it is not, please click it. After, click the âgoâ button. Youâll then have the option to save the .sql file to your desktop or another folder.
Downloading the WordPress files:
1. You will need to navigate to where your WordPress installation is located and copy/download to following files/directories:
DIRECTORIES:
wp-admin
wp-content
wp-includes
FILES:
.htaccess
index.php
wp-activate.php
wp-blog-header.php
wp-comments-post.php
wp-config-sample.php
wp-config.php
wp-cron.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php
Importing the database into your new hosting account (or new cPanel account)
1. Create the new database & user
In your cPanel account where you wish to put the new WordPress install, youâll want to create a new database using the information found in step 1 from your wp-config.php file â database_name (only enter the second part after the underscore). Youâll add this from cPanel > mySQL Databases.
After creating the database, youâll need to assign a user to it. To add a user, scroll down towards the bottom where you created the database at and youâll see the option to create a user. Youâll want to use the same username found in the wp-config.php file or create a new one if one doesnât exist. (username_here â you want to use the value after the underscore). Enter a password (make sure to note the password) and add.
After adding the user, youâll see the option for permissions â you want to select all permissions, then click add.
2. Upload the files that were downloaded above into the new installation directory â this is typically in the public_html folder. If you are installing in another directory, youâd upload the files into that directory.
After uploading, navigate into the wp-config.php file and locate the entries below:
/* MySQL settings */
define( âDB_NAMEâ, âdatabase_nameâ );
define( âDB_USERâ, âusername_hereâ );
define( âDB_PASSWORDâ, âpassword_hereâ );
define( âDB_HOSTâ, âlocalhostâ );
define( âDB_CHARSETâ, âutf8â );
You will need to edit the variables above to reflect the database name, username & password we created previously.
Import the new mySQL database
For this, you will repeat the steps in reverse that we took to export the database:
1. In phpMyAdmin, highight the new database your created. Youâll see there will not be any tables on the right.
2. At the top, click âImportâ. Youâll see the browse button that will allow you to browse to a file. Click browse & locate the file you previously saved containing the .sql extension.
Thatâs it! Your new WordPress site should now be viewable. If you see any errors, donât hesitate to open a support ticket with our tech support.
If you have any web hosting questions please feel free to reach out to us. We're happy to help.