Upgrading from 3.3 to 3.5 - Database collation error

Upgrading from 3.3 to 3.5 - Database collation error

by Conn Warwicker -
Number of replies: 2
Picture of Core developers Picture of Plugin developers

I've been trying to upgrade our moodle frmo 3.3 to 3.5 today, but keep running into this error:


Debug info: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
SELECT * FROM mdl_config_plugins where plugin=? and name LIKE ? COLLATE utf8mb4_bin ESCAPE '\\'
[array (
0 => 'hub',
1 => '%\\_httphubmoodleorg',
)]
Error code: dmlreadexception


I've been through the guide here: https://docs.moodle.org/32/en/Converting_your_MySQL_database_to_UTF8


I've set the various settings in the my.cnf file, I've run the mysql_collation.php cli script. 


Here are the character sets and collations:


screenshot


And here is the my.cnf file:

scerenshot2


character_set_system apparently can't be overriden, so that is still utf8.

I'm not sure why collation_connection is general and not unicode, i'm setting it with an init-connect, but obviously that's not working.


As you can see the table is utf8mb4, the columns are all utf8mb4:



Nothing is latin1, so I just don't know where that error is coming from.


Strangely, if I run the SQL command manually:

    SELECT * FROM mdl_config_plugins where plugin= 'hub' and name LIKE '%\\_httphubmoodleorg' COLLATE utf8mb4_bin ESCAPE '\\'

The error I get is:

    Error Code: 1253. COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'utf8'


At this point i'm just very confused...

Average of ratings: -
In reply to Conn Warwicker

Re: Upgrading from 3.3 to 3.5 - Database collation error

by Ken Task -
Picture of Particularly helpful Moodlers

Have been 'bitten' (ouch!) by the same thing!! :\

You haven't mentioned version of MySQL (or maybe I missed it) but I have several servers that meet minimal for 3.5 mdl and they are all 5.5.31 ... just  a little over version required.  (yes, I know they should be upgraded ... customer hates change and has 'if it's working, don't fix it' mind set. :\)

So try this ... insert the following into your my.cnf under the [mysqld] tag (whatever the server tag is).

character_set_client_handshake=false

Restart MySQL service of course and TIA (try it again).

BTW, think command line mysql or even browser based is, to the DB server, a client.

'spirit of sharing', Ken



In reply to Ken Task

Re: Upgrading from 3.3 to 3.5 - Database collation error

by Conn Warwicker -
Picture of Core developers Picture of Plugin developers

I had tried that before without any luck, but tried again with a fresh DB and seemed to work, thanks.