SOIS cPanel (How To) Fix "Error establishing a database connection"
1. Log in to your cPanel account at cPanel Login
2. Click on File Manager in the Files section.
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.
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.
***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.
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.
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).
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.
13. Click the Go Back link.
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.
17. Click the ALL PRIVILEGES checkbox and click the Make Changes button.
18. Your WordPress site should no longer display the error message below.