One of a solution to fix the problem “Error establishing a database connection” happens in your blog which is run in WordPress application is double check and fix your WordPress blog configuration file.
To fix configuration file, wp-config.php, where the site’s database information located, we need to
- Login your cpanel
- Go to File Manager under Files
- Go to our site’s files
- Open wp-config.php
Solution #01: Now let going double check
- database name
- database user
- database password
- database table prefix table
- hostname. Usually, it’s “localhost” and we don’t need to change; however, there are sometimes we need to change to the right path and it’s is up to hosting service company which we’re using. If there is nothing wrong with my memorization, then blue host uses something unique other than “localhost”. If the message is still not gone away, we can ask hosting service to make sure.
Solution #02: If solution #01 doesn’t work, then we add define(‘WP_ALLOW_REPAIR’, true); to wp-config.php file.
- Add a define code wp_allow_repair and save the file.
- Open a window and type in our site’s address, for example, http://www.yoursite.com/wp-admin/maint/repair.php.
- When it’s done, everything is fine, don’t forget to remove the line of define code wp_allow_repair out of wp-config.php and save the file.
Hoping that the solution #1 or #2 can fix the problem.