Down at the Farm 0
For a short while, this blog was throwing the dreaded “Error Establishing a Database Connection” error.
I was able to fix it (quite impressing myself along the way). Here’s what I did, in case you encounter this error yourself.
First, I logged in to may hosting provider and tried to start phpMyAdmin, a tool for managing MySQL and MariaDB databased. PhpMyAdmin could not connect to the database, it threw a socket error; note that the “socket” is not real, it’s virtual.
Then I opened the file manager and renamed the main page from index.php
to index.php-wp
. It really didn’t matter what I renamed it to, as long as it was no longer index.php. This is because, when a web browser hits a website, the first file it looks for is index.html
, then it looks for index.php.
As a matter of course, I keep an index.html
file in the root directory of the blog, generally renamed to index.html.[somethingorother]
for just such occasions. I renamed it to index.html
edited it to include a brief description of the problem, so that, when one of my two or three regular readers hit the blog, they would know that the problem had been noticed and repairs were underway.
I went back to phpMyAdmin and now was able to connect to the database to do a check, repair, and optimize. I do not know why I was able to connect to the database at that point. By best guess is that, with index.php
out of action, the database was no longer being called.
I tested that the database was now working–that is, I could connect to the blog normally, renamed to index
files to their respective normal names, and tested. Then I breathed a sigh of relief.
And, best of all, I didn’t have to call tech support. My hosting provider’s tech support is excellent, but even so . . . .