This error happens when your configuration files are referencing the wrong database, or your website isn’t able to connect to the right database. While this error is not specific to WordPress and could happen for any website with a database, on WordPress sites the most common cause is a misconfiguration of your wp-config.php file.
If you get an “Error establishing database connection” error neither your site or your WP dashboard will be accessible. So, you need to login to your 10Web dashboard and:
- “Restore” to one of the automatically generated restore points from “Hosting Services –> Restore Points.”
If restoring doesn’t fix the issue,
- Edit wp-config.php.
Use your username and password from “Hosting Services –> Info –> SFTP” to log into your FTP client (you can download FileZilla, for example, if you don’t have one). Click here for additional information on how to use FileZilla.
Click on the WordPress root directory ( web/wp-live) then right click on “wp-config.php” and choose “View/Edit.”
Look over the database settings near the top of the file and make sure the database name (DB_NAME) , DB username (DB_USER) and DB Password (DB_PASSWORD) are defined correctly. If they’re not, change them manually.
Not sure what your database name and username are? Look them up in “Hosting Services –> Info –> Database Access.”
Save the file and hopefully your website will be back online!
If this fails as well, you have no choice but to
- Contact us and we’ll be happy to get your site back online ASAP.