Error when install Moodle 4.5.4

Error when install Moodle 4.5.4

by T.I. Production -
Number of replies: 8

Hello, I am trying to install Moodle 4.5.4, and every time this error appears. I have already created several different databases and tried changing the prefix. But this error keeps showing up...
MySQL 8.0.0, PHP 8.1

Here is part of the error.

Attachment image_2025-05-07_11-48-27.png
Attachment image_2025-05-07_11-48-41.png
Average of ratings: -
In reply to T.I. Production

Error when install Moodle 4.5.4

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Where did you get the Moodle code? What instructions are you following to install Moodle? What server/hosting/OS are you installing on?
In reply to T.I. Production

Error when install Moodle 4.5.4

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

Here is part of the error.

Can you share the rest of the definition of mdl_course that's chopped at the bottom:

CREATE TABLE mdl_course (...

It would be useful to see the bit like:

  `role` bigint(10),
  CONSTRAINT PRIMARY KEY (`id`)
  , KEY `mdl_courcompcrit_cou_ix` (`course`)

MySQL 8.0.0

Really? Version 8.0.0 is from 2018, the latest 8.0.x is 8.0.41.

In reply to Leon Stringer

Error when install Moodle 4.5.4

by T.I. Production -

I will send the full error message below.

In reply to T.I. Production

Error when install Moodle 4.5.4

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

Perfect, thank you.

I asked for the definition of mdl_course by mistake, I should have asked for mdl_course_completion_criteria. From this error we can see that the definition for mdl_course_completion_criteria is:

CREATE TABLE mdl_course_completion_criteria (
id BIGINT(10) NOT NULL auto_increment,

role BIGINT(10),
CONSTRAINT PRIMARY KEY (id)
, KEY mdl_courcompcrit_cou_ix (course)
)

The error is caused by your old version of MySQL, in MySQL 8.0.0 role was a reserved word not allowed for column names. This was changed in MySQL 8.0.1 so you must use at least this version.

Average of ratings: Useful (5)
In reply to Leon Stringer

Error when install Moodle 4.5.4

by T.I. Production -
Thank you!