A while back I had some problems with MySQL running out of space on /var. Today I found out my Gallery2 was down, responding to all requests with “An error has occurred while interacting with the database.”
In the config.php file in the gallery2 install folder, there’s a line that sets the debug mode. By default it’s:
$gallery->setDebug(false);
For debugging I changed it to:
$gallery->setDebug('buffered');
and reloaded the Gallery main page. That displays a shitload of debug messages at the end of the page. In my case, I saw the familiar MySQL message about a table being corrupted. This time, it was g2_CacheMap. I did a quick repair table g2_CacheMap in mysql, and voila!, Gallery is back up.
insha’allah, this is the last such problem.