Error establishing a database connection

stylesheet is missing
WordPress Error – Stylesheet is missing
November 28, 2016
stop spam from ruining google your analytics data
Stop spam from ruining your google analytics data
March 9, 2017

Error establishing a database connection – WordPress Problems

Error Establishing A Database Connection

If you get this error – “Error establishing a database connection” when you try to access your website, it means that WordPress is experiencing an issue when trying to access your  database.

Special Offers, Tips & Advice

Receive our monthly bulletin and get special offers, tips and advice delivered to your inbox - free!

Thank you for subscribing to our monthly bulletin.

Something went wrong. Please contact us!

Why is this happening?

The cause could be an issue with the wp-config.php file. On most occasions, details related to your database have not been entered correctly or are currently not correct.

If you are on a shared hosting server, you may not have access to the wp-config.php file, so you may need to contact your website host. Many shared web hosting providers keep limits on databases, if your database is using over the allocated quota, you can receive a connection error. It could also be possible that your web server is down. It’s important to also consider the possibility that your website may have been hacked if this issue occurs.

The Solution

If you can access your website via FTP, find the wp-config.php file. Open it. Once you have opened the wp-config.php file, check that the following details are correct:

  • database name
  • database username
  • database password
  • database host

Sometimes when migrating websites, moving to a new server or restoring an old backup – these details can get changed. If you haven’t changed servers, hosts or had an backups re-installed recently then it could have been a hack. Contact your hosting provider for further support.

You can scan your website for malware if you use Sucuri or Wordfence. To scan your website without wp-admin access, we would recommend  using Sucuri’s sitecheck scanner – https://sitecheck.sucuri.net/

The WordPress Codex also has a lot of good information and an FAQ to help you out in this instance.

If your web server is down or you have been exceeding your allocated quota, contact your hosting provider so they can rectify the issue.

Still stuck?

Send us a message and we’ll be happy to help!

Jason
Jason
In 1999 I created my very first website, it all went from there. Founder of WP Manager (wpmanager.co.uk). WordPress Developer with a passion for technology and travel.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Send this to a friend