MySQL 5.7 Upgrades By Web Hosts Can Lead to or Expose MySQL Table Issue That Causes Errors on Websites

We were recently brought in to provide support for a Moodle website where when submitting an answer to a quiz question the following error was shown:

Error reading from database

That error message doesn’t provide much to go on. Something like that should not happen randomly, so some change likely caused it, but the webmaster for the website wasn’t aware of any changes that had occurred shortly before that happened.

Turning Moodle’s debugging to its highest setting led to more details being shown about the error:

Debug info: Table ‘performance_schema.session_variables’ doesn’t exist
SHOW VARIABLES LIKE ‘max_allowed_packet’
[NULL]
Error code: errorprocessingresponses

That table isn’t a Moodle table, but instead one that is one of the tables for the MySQL database server.

When we did a search on part of that message we found a Stack Overflow conversation that seemed to match the situation, as the MySQL version in use, 5.7.26, had been out for less than week, so it must have been recently upgraded to and that conversation described the error occurring after an upgrade to a version of 5.7.

Based on the information in that conversation either something gets messed up with that table when doing the upgrade or there was a pre-existing issue that is now causing an error because MySQL 5.7 is relying on that table in a way it previously wasn’t.

If you have dealt with the tech support at a web host before you might not be surprised what came next. When they were contacted about the issue they at first didn’t address what was being mentioned and suggested unrelated solutions. When it came to the former, they stated they couldn’t downgrade MySQL, which was an odd response to the suggestion that the upgrade needs to be fixed. When it came to the latter, they were suggesting upgrading Moodle, claiming that it would resolve this and that the new version was compatible MySQL 5.7 (the version of Moodle in use was actually also compatible with that version of MySQL).

While it took several back and forths between them and our client, eventually they seem to come around that there really was an issue on their end and from there it took tens of minutes for it to be fixed, much to the relief of our client.