How to Fix the Error Establishing a Database Connection

If you have been surfing the web for a while, you have at least seen this error a few times. Error Establishing a Database Connection is one...

If you have been surfing the web for a while, you have at least seen this error a few times. Error Establishing a Database Connection is one of those curses that could be caused by many reasons. As a WordPress beginner, this could be awfully frustrating specially when it happened on its own without you changing anything. We ran into this issue yesterday on our own site. It took a little over 20 minutes to detect and fix the problem. While doing the research to find possible causes, we realized that there was no good article that covered everything. In this article, we will show you how to fix the error establishing a database connection in WordPress by compiling a list of solutions all in one place.

Note: Before you make any database changes, make sure you have sufficient backups.

Responsive Menu

Why do you get this error?

Well in short, you are getting this error because WordPress is unable to establish a database connection. Now the reason why WordPress is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. In our experience, majority of the times this error happens because of some sort of server error however there could be other factors as well. Lets take a look at how to go about troubleshooting this problem.
Does the problem occur for /wp-admin/ as well?

First thing you should do is to make sure that you are getting the same error on both the front-end of the site, and the back-end of the site (wp-admin). If the error message is the same on both pages “Error establishing a database connection”, then proceed onto the next step. If you are getting a different error on the wp-admin for instance something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database.

You can do this by adding the following line in your wp-config.php file. Add it just before ‘That’s all, stop editing! Happy blogging’ line wp-config.php.

COMMENTS

Blog Okay
Name

Blogger Story Thumblr Weebly Wordpress
false
ltr
item
KabalNews: How to Fix the Error Establishing a Database Connection
How to Fix the Error Establishing a Database Connection
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUoZg-xoyYTmC5PKTSw19aNqgc2JHJaT75zyyd3hsT87FbU1m0SxDIWvt0P5mqUUMkS9C0oDDXF4qBoUUJ2EgFdWkgzA-K81d58UX-4tFZfGqIlWmHURC5du2nfG-4C7biXwY5jBZBur4/s1600/8.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUoZg-xoyYTmC5PKTSw19aNqgc2JHJaT75zyyd3hsT87FbU1m0SxDIWvt0P5mqUUMkS9C0oDDXF4qBoUUJ2EgFdWkgzA-K81d58UX-4tFZfGqIlWmHURC5du2nfG-4C7biXwY5jBZBur4/s72-c/8.png
KabalNews
https://kabalnewsresponsive.blogspot.com/2016/04/how-to-fix-error-establishing-database.html
https://kabalnewsresponsive.blogspot.com/
http://kabalnewsresponsive.blogspot.com/
http://kabalnewsresponsive.blogspot.com/2016/04/how-to-fix-error-establishing-database.html
true
4616618672923350927
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy