Error establishing a database connection only on some pages

I have a WordPress site which runs smoothly most of the time. However, from time to time, certain pages simply stops working and gives the good old “Error establishing a database connection”, while the rest of the site continues to run without any issues whatsoever.

This problem goes away as soon as I restart the server, but usually comes back within a few days, sometimes within a day.

I can’t find anything in the error logs (also, mysql.log is empty), so I’m not sure exactly what to do here, or even how to locate the root of the problem. The site goes into this “state” at seemingly random times, and I’m making no changes to it whatsoever.

I have of course googled around but none of the answers that I’ve found solves mmy particular problem.

Does anyone have a clue about what can be causing this? I’m using Ubuntu.

Any help is very much appreciated. Thanks!

Solutions Collecting From Web of "Error establishing a database connection only on some pages"