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 update your configuration 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

  1. Log into your cPanel account.

  2. Click on File Manager located in the Files section of cPanel.

     open_filemanager

  3. Choose web root and make sure to check show hidden files. Next, click Go.

  4. In the right window pane of file manager, navigate to the folder to which you uploaded WordPress.

  5. Find the file wp-config.php, right-click on it, and choose edit.

    edit_wp-config

Editing 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 ** //
/** The name of the database for WordPress */
define('DB_NAME', 'userna5_wp1');

/** MySQL database username */
define('DB_USER', 'userna5_wp1');

/** MySQL database password */
define('DB_PASSWORD', 'passwordgoeshere');

/** MySQL hostname */
define('DB_HOST', 'localhost');

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:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'inmoti5_wpress');

/** MySQL database username */
define('DB_USER', 'inmoti5_wpuser');

/** MySQL database password */
define('DB_PASSWORD', 'secretpassword123');

/** MySQL hostname */
define('DB_HOST', 'localhost');

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.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve our Support Center:
Email Address
Optional, but our team may contact you for more information.
Like this Article?

Post a Comment

Name:
Email Address:
Comment:
Are you a bot?
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!