Singapore & Australia # 1 for Web Hosting & Domains
SG: +65 6018 3544   AU: 1300-863-436 Asset 1colo Help
Vodien Logo
  1. Home
  2. Knowledge Base
  3. CMS
  4. How to Change Database Configuration in WordPress

How to Change Database Configuration in WordPress

A WordPress website, or any website for that matter, cannot work without a database. Using a database is an organized way of storing information and is accessible via phpMyAdmin in cPanel. All the information shown on your website are requested from the database.  

 Vodien web hosting plans provide more than one database. Correct database configuration is needed to make sure your WordPress website is requesting the data from the correct database. Incorrect database configuration results to an error page on your WordPress website as shown in the screenshot below.

WordPress Database Connection Error Page

The goal is for the wp-config.php file of your WordPress website to have the correct database name, database userand database password. 

Important Note: Make sure this process is done overnight when there are least expected visitors on the website. Do the preparations listed below before applying changes to your website:  

  • Secure a backup of WordPress website files. 
  • Secure a backup of WordPress database SQL file. 
  • Check the details of the new version and make sure that it is compatible with the current WordPress version you are using.

1. Check current database details in wp-config.php file. 

Note: If you can’t find the wp-config.php file in your website files, create one or check your backup files and upload it to your website directory.

Step 1Log in to cPanel.  

Step 2. Click the File Manager button under Files category. 

File Manager Button in cPanel

Step 3. Access your WordPress website files and right-click on wp-config.php file.

Wp-config File in File Manager


Step 4. Click Edit.

Edit Wp-config File in File Manager  

Step 5. Click Edit on the pop-up

Wp-config File Edit Warning in File Manager

Step 6. Take note of the DB_NAMEDB_USER, and DB_PASSWORD which are on lines 2326, and 29 respectively. The values are in between the single quotes (‘). 

WpConfig File Details

2. Check the database details in MySQL Databases. 

Step 1. In cPanel, click MySQL Databases in Databases section. 

MySQL Databases Icon in cPanel

Step 2. Under Current Databases, check if the DB_NAME is on the list with its corresponding Privileged User. The privileged user should be the DB_USER in your wp-config.php file. 

Current Databases Section in cPanel

Step 3. If both DB_NAME and DB_USER matched with what’s in the wp-config.php file, it might be the password that is mismatched. The DB_PASSWORD can’t be seen but can be reset. Copy the DB_PASSWORD from wp-config.php file and use it as the new password. 

Step 4. In MySQL Databases, scroll down to Current Users.   

Step 5. Click on the corresponding Change Password link of the DB_USER.  

Change User Password in MySQL Databases

Step 6. Enter the copied password from Step 3 in the two empty boxes.

Note: This is not a password that you will use from time to time so it’s okay to use a long and complicated one. Just make sure to take note of the password so that you can put it later in wp-config.php file.

Step 7. Click the Change Password button. 

Enter New User Password For Database

Step 8. Check the website if it’s already working. If the error stays the same, proceed to the next steps below.  

3. Edit wp-config.php file with the correct information.

Step 1. Open the wp-config.php file and edit the following with the correct database information. 

  • Replace the database name in between the single quotes (‘) on line 23 
  • Replace the database username in between the single quotes (‘) on line 26 
  • Replace the database password in between the single quotes (‘) on line 29 

 Step 2. Save changes. 

Save Changes on WP Config File

Step 3. Check your website if it’s now working. 

Missing Database 

If the database is missing, follow the steps below.  

  1. Create a database and its user.  
  2. Import your database backup to phpMyAdmin.  
  3. Edit wp-config.php file with the correct information. 

Do not hesitate to contact our Singapore or Australia Support Team if you have further questions. 

(Visited 14,215 times, 5 visits today)
Updated on July 7, 2021

Was this article helpful?

Related Articles