How To Deal With Error Establishing A Database Connection
Dealing with and fixing the “Error establishing a database connection” is one toughest situation which many webmasters and webpage owners find themselves in due to the nature of the problem with its cause being a guess other than a known one in many cases. This problem does occur on the different sites using the different content management systems for example WordPress, Joomla and many others which support databases and that for the inexperienced or the less knowledgeable users, such a time is a hard one to go through since it involves many head scratches in a bid to find out the possible cause and looking forward for a solution which can help in having the problem solved.
The Error Establishing A Database Connection is a one situation which I went through on this very website a few days day back and thanks to my hosting provider who was able to deal with it although it took a few additional hours more than was expected. Having your website or blog visitors welcomed by such a message is one thing which not only hurts but too makes the reader think twice whenever he or she comes across your webpage link in search results before attempting to visit it and for those who hate the same like me, it may take some weeks before eventually coming back to such a site even if it pops up on every search query made and which is a bad and negative effect on the site.
Remember, when a site goes off for a few hours or even a half day, there is a big impact which is experienced as a result although you may not see it right away for example on my side, I lost a good number of visitors since then, my site Alexa rank dropped a bit, my revenues were impacted and somehow somewhere, my relationship with my host and who doubles as a friend was shaken up due to the fact that I seemed over pressurizing him to have my site up yet that is the same thing he was trying – thanks, we were able to solve that.
And if you happen to be experiencing the same problem and not knowing the cause and how to solve it, below are the suggestions you must try before everything else.
Use Control Panel To Detect The Problem – If you have access to your cPanel, that is a good way to start. Try to log in to your dashboard and click on the view status link. On the next page, you will be able to see the different statuses of your website for example Server Load, Memory Used, cpanellogd and others. Put more emphasis on the MySQL since the problem you have concerns it and if you see a failure notice or contact your provider.
Contacting Your Hosting Provider – The next thing you need to do and which I suggest basing on my own experience is contacting your service provider immediately you get to see such. If you have their phone contact, use that option since it appears to be the best one. Let your provider try to troubleshoot the problem and possibly identify the cause and the solution at the same time. In so many cases, the problem is originating from your providers end which means that you can do nothing totally. Remember, its a database connection error. And basing on what you discover, consider doing the following below.
Revert All Changes You Had Previously Made – If the problem came after a change of something on your site for example installing a plugin, try to delete it first and retry to see if it helps. You can do such changes basing on when the problem happened and when the changes had occurred.
Check Out Your config.php File – This is a file which contains your database name and password. You need to access your site using FTP or File Manager so as to make sure that there is nothing like any change in them. If by any mistake you changes either the username or password, you will need to revert them or correct the File.
Try To Add A Default Port Number – Check out your PHP.INI file and add 127.0.0.1:3306 or 127.0.0.1:3307 next to your host Address field.
Consider An Upgrade – This problem is very common on most free hosting services with exception of a few which offer a high class service. If you are on a free host, it may be time for you to upgrade to a better plan since in many cases, it involves some shifts.
Note : For which ever step you attempt, you need to ensure that you do a back of that very file you want to edit to avoid more confusion.
Liked this article or found it helpful? Share it with your friends using the social share buttons below and or post a comment to let us know your feedback or any addition using the comment form below..