SOIS cPanel (How To) Fix "Error establishing a database connection"

This document was written to assist in fixing the WordPress "Error establishing a database connection" for sites that reside on the SOIS cPanel server (soisweb.uwm.edu).

error establishing database connection

1. Log in to your cPanel account at cPanel Login

2. Click on File Manager in the Files section.

File Manager

3. Navigate to the root folder of your WordPress site.  (i.e. if the URL for your site is https://dew3534.soisweb.uwm.edu/wordpress/ you'd navigate to the /home/dew3534/public_html/wordpress folder) ***note that your path will contain your username!

4. Find the file titled wp-config.php, right click on it, and click view.

view

5. Find the Database settings section of the wp-config.php file and make note of these 3 entries; DB_NAME, DB_USER, and DB_PASSWORD.

DB_NAME, DB_USER, DB_PASSWORD ***Please note that the values reside between the single quotes. Do not include the single quotes with the values!

6. Close the wp-config.php view by clicking the X in the upper right-hand corner of the black title banner.

wp-config.php banner

7. Return to the Tools screen of your cPanel account. (the back button on your browser may take you there, or you may need to log back in from URL in step 1)

8. Click on the Manage My Databases link in the Database section of the Tools page.

manage my databasees

9. Scroll down to the Current Databases section.and make sure the DB_NAME you noted in step 6 exists in the list of Current Databases (name must match exactly).

current databases

10. Scroll down to Database Users Add New User section.

11. Enter the DB_User name you noted in step 6 into the Username box (note that you should only type in the text after the underscore character following your ID at the beginning of the name.  I'm only typing in wp_dxee0 in my case)

12. Type your DB_PASSWORD value from step 6 into the Password and Password (Again) boxes and click the Create User Button.

add new user

13. Click the Go Back link.

go back

14. Scroll down to the Add User To Database section.

15. Select the user you just created (DB_USER from step 6) in the User drop down, and select the associated database from the Database drop down list (DB_NAME from step 6), then click the Add button.

add user to database

17. Click the ALL PRIVILEGES checkbox and click the Make Changes button.

all privileges

18. Your WordPress site should no longer display the error message below. 

Error Establishing database connection



KeywordsWordPress soisweb.uwm.edu Webspace   Doc ID139043
OwnerDave E.GroupUW-Milwaukee Help Desk
Created2024-08-09 12:33:15Updated2024-08-12 12:25:41
SitesUW-Milwaukee Help Desk
Feedback  0   0