XF 2.2 Database error - connection refused

StevePrep

Member
Hello,

Our forum has recently occasionally started throwing the following error:

An unexpected database error occurred. Please try again later.
<!-- Connection refused -->

Refreshing the page then fixes it.

We are using v2.2.10 Patch 1 and no changes have been made to it since I upgraded it in August 2022. Our hosting provider say they are not seeing anything obvious their end.

I have put it in debug mode which I believe will record errors to the xf_error_log table but if it can't connect then I don't know if that's going to yield much.

Has anyone seen this before? I have read some existing posts about this but I've not found a conclusive solution.

Thanks
 
Solution
Odds are you are having a mySQL issue... OOM or the mySQL server instance quits responding.
Are you on shared hosting, a dedicated server or a VPS?
If VPS/Dedi, have you checked your server and mySQL logs?
All that error means is that YOUR mySQL server connection has quit connecting because it's being refused by the server for some reason.
XF attempts to connect using the credentials in the config.php file.

If the connection is being randomly refused then I would have to suspect some sort of random intermittent server issue.
 
Odds are you are having a mySQL issue... OOM or the mySQL server instance quits responding.
Are you on shared hosting, a dedicated server or a VPS?
If VPS/Dedi, have you checked your server and mySQL logs?
All that error means is that YOUR mySQL server connection has quit connecting because it's being refused by the server for some reason.
 
Solution
Thanks.

We are on shared hosting. I am in contact with them about it. If they can't find the fault then we will consider moving.
Frequently on a shared hosting environment, this can indicate (without seeing the mySQL log) that you have exceeded your mySQL connections allowed. On a shared hosting plan they can be somewhat restrictive.
 
Back
Top Bottom