So far in this tutorial you have migrated your WordPress database and copied the files associated with your website. The next step you will need to configure your WordPress settings so the files you just migrated can communicate correctly with the database. Until you perform this, your site will not display any content and you will receive a database connection error.
A few steps ago in this tutorial we asked you to write down the database name, username, and password. Now, we will need this information to continue the migration process.
Opening the wp-config.php file
- Log into your cPanel account.
- Click on File Manager located in the Files section of cPanel.
- Make sure you are able to view hidden files.
- Navigate to the the folder to where you uploaded WordPress.
- Click the wp-config.php file, then click the Edit link on the top menu.
Configuring the wp-config.php file
For the purposes of this tutorial we will say we created the database with the following database credentials:
- Database name: inmoti5_wpress
- Database username: inmoti5_wpuser
- Database password: secretpassword123
Our current cpanel username is inmoti5 and as you will notice it automatically adds the prefix to database names and usernames.
|The database credentials that WordPress uses to connect to your database are contained within the wp-config file. What we will need to do is find the files and simply change them. Start off by finding this section within the wp-config.php file:|
// ** MySQL settings – You can get this info from your web host ** //
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
Take a look carefully at the above code, and you should see that this file is define what the database name, username, and password are. The value ‘localhost‘ is very commonly defined as the host, and the average user does not need to change this. After you find this section, update the values accordingly. In our example, the new changes will look like this:
After you’ve made the above changes, click the Save Changes button in the upper right.
There are only a couple of steps left to migrating your WordPress site. In the next tutorial we will discuss how to correct image links from your posts and pages.
Please check the next article on Correcting image links after a WordPress migration. If you missed our previous article, please see the Migrating WordPress Files tutorial. For more information on this course please visit Migrating your Existing WordPress site to InMotion Hosting.