Loading...

Knowledge Base

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.

Screenshot of VD 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 user, and 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.

  1. Log in to cPanel.
  2. Click the File Manager button under Files category.

    Screenshot of VD File Manager Button in cPanel

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

    Screenshot of VD WordPress wp-config File
     
    TIP:
     

     
  4. Click Edit.

    Screenshot of VD WordPress wp-config Edit Option

     
  5. Click Edit on the pop-up.

    Screenshot of VD WordPress wp-config Popup Edit Button

     
  6. Take note of the DB_NAME, DB_USER, and DB_PASSWORD which are on lines 23, 26, and 29 respectively. The values are in between the single quotes (‘).

    Screenshot of VD WordPress wp-config Details

     

 

2. Check the database details in MySQL Databases.

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

    Screenshot of VD WordPress My SQL Databases Option

     
  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.

    Screenshot of VD WordPress Current Databases Table

     
  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.
  4. In MySQL Databases, scroll down to Current Users.
  5. Click on the corresponding Change Password link of the DB_USER.

    Screenshot of VD WordPress MySQL Change Password Option

     
  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.


     
  7. Click the Change Password button.

    Screenshot of VD WordPress mySQL Change Password Fields

     
  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.

 

  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

     
  2. Save changes.

    Screenshot of VD WordPress MySQL Save Changes Button

     
  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.

 

 

 

Did you find this article helpful?

 
* Your feedback is too short

Loading...