After migrating to new server, Moodle gives me "Error reading from database" message

After migrating to new server, Moodle gives me "Error reading from database" message

by Andrew Harris -
Number of replies: 3

Hello, 

First-time poster and relative newbie to Moodle. I've attached my debugger results and was hoping someone could point me in the right direction in getting my course back up and running. 

Thank you!

Attachment Screen Shot 2020-02-12 at 4.24.48 PM-01.png
Average of ratings: -
In reply to Andrew Harris

Re: After migrating to new server, Moodle gives me "Error reading from database" message

by Ken Task -
Picture of Particularly helpful Moodlers

Looks like DB for your moodle isn't fully supporting character set utf8mb4 and a collation of that character set.

There's a line in your config.php file related.

What it says on that line, your DB character set/collation must match.

There are some scripts in admin/cli/ of code that will help troubleshoot/correct the issue.

'SoS', Ken

In reply to Andrew Harris

Re: After migrating to new server, Moodle gives me "Error reading from database" message

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

The error looks like it's saying that the table user doesn't exist. That's very odd. Moodle normally has a common prefix for all tables, the default is "mdl_" so the table would be mdl_user. It's possible but unusual to have no prefix, the installer doesn't like this.

Check what the table prefix is in config.php, e.g.:

$CFG->prefix    = 'mdl_';       // prefix to use for all table names

Then check to see if you've got a database table called "user" with the above prefix, e.g. in my list of tables:

  ⋮
| mdl_upgrade_log                  |
| mdl_url                          |
| mdl_user                         |
| mdl_user_devices                 |
| mdl_user_enrolments              |
  ⋮

(Please include background information such as the Moodle version when reporting problems).

In reply to Leon Stringer

Re: After migrating to new server, Moodle gives me "Error reading from database" message

by Ken Task -
Picture of Particularly helpful Moodlers
+1 Leon ... missed that in my response (red in face)
For sure a mis-match of prefix in config.php from what is actually in DB would cause issues.

'SoS', Ken