Moodle Error reading from the database occurs when an improper Storage engine value is entered in the MySQL file.

Here at Bobcares, we have seen several causes for this error while troubleshooting Moodle issues as part of our Server Management Services for Moodle users, web hosts, and online service providers.

Today we’ll take a look at the cause for this error and see how our Engineers fix it.

 

What causes Moodle Error reading from database

Let us now take a look at what causes this error to occur.

In most of the cases, when the variable “storage_engine” deprecates, this error occurs. In MySQL 5.5.3, the storage_engine is deprecated and it is removed in MySQL 5.7.5 version.

So to avoid this issue in MySQL 5.5.3, Moodle should use “storage_engine”. Whereas in MySQL 5.5.3 superior it must use “default_storage_engine”.

This is something Moodle should have fixed by simply checking the MySQL version before calling this line.

This error can occur in many cases that include when logging into Moodle, installing, and also while upgrading moodle.

For instance, the error appears as below:

Moodle Error reading from database

 

How we fix Moodle Error reading from database

Recently, one of our customers approached us with this same error message. He received this error while installing Moodle. Let us now see how our Support Engineers resolve this error for our customers.

Initially, we opened the file: moodle/lib/dml/mysqli_native_moodle_database.php

In this file, we changed the below value,

@@default_storage_engine
to
@@storage_engine

This change immediately fixed the error message.

In some cases, depending on the MySQL version the values can be changed vice versa. This also fixes the issue.

[Need any further assistance in fixing Moodle errors? – We’re available 24*7]

 

Conclusion

In short, ‘Moodle Error reading from database’ can occur in many cases that include when logging into Moodle, installing, and also while upgrading moodle. Today, we saw how our Support Engineers fix this error for our customers,