An unexpected database error ?every now and than?

Hey guys I just setup my first xenforo and I noticed every now and than it gives a weird error i look in the source and find this.

An unexpected database error occurred. Please try again later.
<!-- Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) -->
I than refresh the page and the errors gone
What do? :(

Jake Bunce

XenForo moderator
Staff member
That is a generic MySQL connection error. The database connection is failing for some reason.

Since it's intermittent you can probably ignore it. The server might have been undergoing maintenance or something. But if the error persists then you need to contact your web host.
Thank you I got them to restart mysql and it is still happening if I spam refresh on the page it happends once every 5 refreshes is there by any chance like a setting in php to make it so it doesn't giveup trying to connect to mysql so fast like it will try 20 times or 5 times also I'm using litespeed instead of apache.

Jake Bunce

XenForo moderator
Staff member
This is something the web host needs to fix. Tell them the database connection is failing intermittently. Give them the error message.


If you're on shared hosting, perhaps consider moving to a hosting provider that doesn't have stability issues with their MySQL server. If you're on a VPS, there might be a different underlying problem that requires a super user to take a look at the mysql log file to find out why it's shutting down (restarting perhaps).