Fail to upgrade from moodle 2.7 to 3.1 cause of Illegal mix of collations

Fail to upgrade from moodle 2.7 to 3.1 cause of Illegal mix of collations

by hugo joe -
Number of replies: 3

System: centos 7 + mariadb + Nginx + php-fpm

Upgraded form 2.6 to 2.7 via Command line. But failed to upgrade to 3.1.

This is error message:

-->mod_quiz

Debug: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

 

            SELECT gi.id, gi.itemnumber, cm.id AS cmid

              FROM mdl_quiz q

        INNER JOIN mdl_course_modules cm ON q.id = cm.instance

        INNER JOIN mdl_grade_items gi ON q.id = gi.iteminstance

        INNER JOIN mdl_modules m ON m.id = cm.module

             WHERE q.completionpass = 1

               AND gi.gradepass = 0

               AND cm.completiongradeitemnumber IS NULL

               AND gi.itemmodule = m.name

               AND gi.itemtype = ?

               AND m.name = ?

[array (

  0 => 'mod',

  1 => 'quiz',

)]

Error code: dmlreadexception

* line 474 of /lib/dml/moodle_database.php: dml_read_exception thrown

* line 1088 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()

* line 209 of /mod/quiz/db/upgrade.php: call to mysqli_native_moodle_database->get_records_sql()

* line 726 of /lib/upgradelib.php: call to xmldb_quiz_upgrade()

* line 432 of /lib/upgradelib.php: call to upgrade_plugins_modules()

* line 1742 of /lib/upgradelib.php: call to upgrade_plugins()

* line 181 of /admin/cli/upgrade.php: call to upgrade_noncore()

 

!! Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

 

            SELECT gi.id, gi.itemnumber, cm.id AS cmid

              FROM mdl_quiz q

        INNER JOIN mdl_course_modules cm ON q.id = cm.instance

        INNER JOIN mdl_grade_items gi ON q.id = gi.iteminstance

        INNER JOIN mdl_modules m ON m.id = cm.module

             WHERE q.completionpass = 1

               AND gi.gradepass = 0

               AND cm.completiongradeitemnumber IS NULL

               AND gi.itemmodule = m.name

               AND gi.itemtype = ?

               AND m.name = ?

[array (

  0 => 'mod',

  1 => 'quiz',

)]

Error code: dmlreadexception !!

!! Stack trace: * line 474 of /lib/dml/moodle_database.php: dml_read_exception thrown

* line 1088 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()

* line 209 of /mod/quiz/db/upgrade.php: call to mysqli_native_moodle_database->get_records_sql()

* line 726 of /lib/upgradelib.php: call to xmldb_quiz_upgrade()

* line 432 of /lib/upgradelib.php: call to upgrade_plugins_modules()

* line 1742 of /lib/upgradelib.php: call to upgrade_plugins()

* line 181 of /admin/cli/upgrade.php: call to upgrade_noncore()

 !!

I tried to use command "php mysql_collation.php  --collation=utf8_unicode_ci

", got this message:

mdl_user                                 - CONVERTED

    auth                                 - CONVERTED

    username                             - !!! DDL sql run error.



Thanks for your help.  

Hugo



Average of ratings: -
In reply to hugo joe

Re: Fail to upgrade from moodle 2.7 to 3.1 cause of Illegal mix of collations

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There's something you're not telling us...

Did you dump and re-upload the database into a different server (with different default collation settings)?

In reply to Howard Miller

Re: Fail to upgrade from moodle 2.7 to 3.1 cause of Illegal mix of collations

by hugo joe -

I am sorry.

I did backup the database to sql file from my old server (centos 6 running moodle 2.6+ mysql )using mysqldump. Then I restored the sql to the new server ( centos 7).

My old server: CHARACTER SET utf8 ;  COLLATE utf8_general_ci

My new server: CHARACTER SET utf8 ;  COLLATE utf8_unicode_ci

In reply to hugo joe

Re: Fail to upgrade from moodle 2.7 to 3.1 cause of Illegal mix of collations

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Does that solve your problem then? Or, at least, point you in the right direction?