If you’re getting the error like “Error establishing a database connection“, you’re not alone. Sometimes, during our blogging, we would see this happens. Honestly, at the first time, we’ve seen that error, we’re frustrated and screw off. Now, after we’ve been there, we’re kind a ready dealing with it if it’ll happen again. That’s why we share our solutions to all of you to avoid any panic might occurs when seeing this type of error. This post does not include all solutions but, at least, there is some we can try.
First, determine whether this error happens after we just change something or it’s just pop up from nowhere. If it’s error because of changing something in the database, then we need to fix where we have changed. On the other hand, we’re going further for details how to fix the problem.
We need to check whether it’s down only WordPress sites or all of our sites (WordPress, smf,…). Just random pick couple of your WordPress sites, your smf forums or any sites which you’re using database.
If we can access some sites but not others, then we need to narrow down to see which sites are down and what types of application are used. If the application is WordPress, then we need to fix the way appropriate with WordPress application. If the application is SMF, then we fix it by SMF way.
Method #1: Configuration file
How to fix “Error establishing a database connection” in SMF application?
- Coming soon!
Method #2: Database connection from cpanel & WH
If we can’t access all of them and there are errors about database, we know that’s something wrong with the database connection from the server. We need to go to cpanel to check our databases there.
- Just login to cpanel
- Go to Database section
- At the list under Database section (MySQL Databases, MySQL Database Wizard, phpMyAdmin, Remote MySQL), pick one of them to see whether it’s connected to the server or not. Usually, we picked phpMyAdmin or MySQL Database.
- If there is an error message popping up by saying something likes not connecting to the mySql server, that means we need to fix it to connect. Here is how to fix them – http://allchit.com/vps-error-while-connecting-to-mysql-cpaneldbimysql-connectroot-failed/.
- If there is nothing wrong and it’s fine going through like most of the time, then we need go to fix…
In this case, we’ve been there yet, so we currently have no answer. When we have an answer, we’ll post here ASAP.