InMotion Hosting Support Center

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

  1. Log into your cPanel account.

  2. Click on File Manager located in the Files section of cPanel.
  3. Make sure you are able to view hidden files.
  4. Navigate to the the folder to where you uploaded WordPress.

  5. 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 ** //
/** 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.

You are viewing Section 4: Configuring WordPress After a Migration
Section 3: Migrating WordPress Files
Section 5: Fixing Image Links after a WordPress Migration

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
How get access to wp-admin
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2017-11-29 11:04 am
Is it safe to edit the original wp-config.php file or should you create a copy first?
40,770 Points
2017-11-29 12:10 pm
It's best practice to make a copy before changing a file. So I would recommend that first. However, you can edit the file without the backup if that's what you want to do. The backup is insurance in case something goes wrong with your change.
n/a Points
2017-02-28 9:25 am

I recently changed my WordPress site to a completely new domain and database. I copied the database over. Everything seems fine. But all the users do not show within Wordpress, but they seem to show within the database. Why is this and how can I fix this?

10,206 Points
2017-02-28 12:31 pm
Even though the information appears to be in the database, it is possible that the database is corrupted. This can derive from a variety of causes but often happens if there was no "database repair" performed before export. I advise running a database repair and exporting the database again.
n/a Points
2016-10-26 7:10 am

For migrations in which the domain name is changed, another setting needs to take place:

In table wp_options in the DB, first two columns needs to be updated with the new domain name.

Post a Comment

Email Address:
Phone Number:

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

7 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


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:
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!