The Error Establishing a Database Connection is one of the most common WordPress errors. It means WordPress cannot connect to its database, usually because of an incorrect database password in the wp-config.php file. This guide shows you exactly how to find and fix it.
Step 1: Log in to cPanel.
Log in to your Hostcry Client Area and open your hosting account. Click on cPanel to access it. You can also go directly to yourdomain.com/cpanel and enter your cPanel username and password.
Step 2: Go to File Manager.
Inside cPanel, find and click on File Manager. This will open your website's file system, where you can view and edit all your hosting files.
Step 3: Open wp-config.php in public_html.
In File Manager, open the public_html folder. This is the root folder where your WordPress files are stored. Look for the file named wp-config.php. Right-click on it and select Edit to open the file editor.
Enable WP_DEBUG to See the Full Error.
After opening wp-config.php, scroll to the bottom of the file. Find the line that says:
Change false to true so it looks like this.
This will display the full error details on your website, helping you identify exactly what is wrong with your database connection.
Step 4: Fix the Database Password in wp-config.php.
The most common cause of this error is an incorrect database password. In the wp-config.php file, look for this line:
You will need to update this with your correct database password. First, you need to get or reset your database password from cPanel — follow Step 5 below
Step 5: Reset Your Database Password in cPanel.
Go back to cPanel and scroll down to the Databases section. Click on MySQL Databases. Scroll down to the Current Users section. Find your WordPress database username it is listed there. Next to your username, click Change Password.
Enter a new strong password and click Change Password to save it. Copy this new password — you will need it in the next step.
Step 6: Update the Password in wp-config.php & Save.
Go back to File Manager and open wp-config.php again. Find the DB_PASSWORD line and replace the old password with the new password you just copied:
After updating the password, click Save Changes in the editor. Now reload your website in the browser the error should be fixed, and your website should load normally again.
⚠️ Remember: After your website is working again, go back to wp-config.php and change WP_DEBUG back to false to hide debug messages from your visitors. define(WP_DEBUG, false).
✓ The "Error Establishing a Database Connection" has been fixed. Your WordPress website should now load correctly with the updated database password.