Problem
When you try to view a WordPress site, you may receive the following error message:Resolution
To resolve this problem, first determine the correct MySQL database settings. Then you can update the wp-config.php file with the correct database settings. To do this, follow the procedures below.Step 1: Determine the correct MySQL database settings
To determine the correct MySQL database settings, follow these steps:-
Log in to cPanel.
📘 Note If you do not know how to log in to your cPanel account, please see this article.
-
In the DATABASES section of the cPanel home screen, click phpMyAdmin:
-
In the left-hand pane of phpMyAdmin, note the name of the WordPress database that you want to use.
👍 Tip Typically, the WordPress database is username_wpXXX , where username represents your cPanel username, and XXX is a three-digit number. However, if your account was recently migrated (for example, from another hosting provider), the database name may be in a different format.
- Click the name of the WordPress database that you want to use. A list of tables in the database appears.
-
In the Table column, note the table prefix that is used in the table names.
👍 Tip Typically, the WordPress database table prefix is wp_ . However, if your account was recently migrated (for example, from another hosting provider), the table prefix may be different, or even nonexistent.
-
On the Tools page, in the Databases section, click Manage My Databases:
📘 Note If you are using cPanel version 118 or earlier, click MySQL Databases instead:
- Under Current Databases, locate the database that you noted in step 3.
-
Note the database username for the database.
🚧 Important If you do not know the password for this database user, you should reset it now.
Step 2: Update the wp-config.php file
After you have determined the correct database settings, you are ready to update the wp-config.php file. To do this, follow these steps:-
In the FILES section of the cPanel home screen, click File Manager:
-
Navigate to the directory where WordPress is installed.
👍 Tip Typically, WordPress is installed in the public_html (document root) directory. However, if you installed WordPress in a subdirectory, navigate to that directory instead.
- Right-click the wp-config.php file, and then click Edit.
-
Locate the DB_NAME setting, and then replace the value with the name of the WordPress database that you obtained in the previous procedure. For example, if your database name is username_wp123, modify the text as follows:
-
Locate the DB_USER setting, and then replace the value with the database username that you obtained in the previous procedure. For example, if your database username is username_wpuser, you would modify the text as follows:
-
Locate the DB_PASSWORD setting, and then replace the value with the database user’s password. For example, if your database user’s password is example_password, modify the text as follows:
🚧 Important It should go without saying that you should not use example_password as a password on a real installation!
-
Confirm that the DB_HOST setting is set to localhost as follows:
-
Locate the $table_prefix setting, and then replace the value with the database table prefix that you obtained in the previous procedure. For example, if the database table prefix is _wp__, modify the text as follows:
📘 Note If your database does not use a table prefix, modify the text as follows:
- Click Save Changes.
- Use your web browser to go to the WordPress site’s URL. The site should now load.