Language customisation Error writing to database after updating to 4.0

Language customisation Error writing to database after updating to 4.0

by martin smith -
Number of replies: 4

Hi

I just updated Moodle to 4.0 from 3.11, Its an AMI I am running on AWS and now I'm getting this error message 'Error writing to database' when I go to Language customisation, I have used admirer plungin to change the character set from utf8  to utf8_general_ci as per a recommendation in one of the forums but it didnt help. I have been through the forums and cant find anything to work that I understand. I'm a beginner developer using Moodle, can anyone help my with this error please. 

Average of ratings: -
In reply to martin smith

Re: Language customisation Error writing to database after updating to 4.0

by Ken Task -
Picture of Particularly helpful Moodlers

There is character set *and* collation involved.

In your Adminer, can you see a tables columns setup for both character set and collation?

In your config.php file there is a DB array of variables ... one is collation.   What you have there ... which to get full support needs to be utf8mb4 character set with uff8mb4_unicode_ci collation.

Got ssh into your server?   In code/admin/cli/ there are some handy mysql_ php scripts that will recursively change character set or collation for all tables and columns in those tables to fully supported.    Running with php nameofscript.php will bring up a help screen with the options one can apply.

Uhhh .. do make a backup of the DB before doing anything more with your DB! smile

'SoS', Ken

In reply to Ken Task

Re: Language customisation Error writing to database after updating to 4.0

by martin smith -
Thanks for that I will give it a go after backing up my DB
In reply to martin smith

Re: Language customisation Error writing to database after updating to 4.0

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

They're two different things: utf8 is a MySQL/MariaDB character set and utf8_general_ci is a collation, but not the recommended one for Moodle, it should be utf8_unicode_ci if the character set is utf8.

Ideally your Moodle database should be converted to the utf8mb4 character set (with default collation utf8mb4_unicode_ci) as this supports the full range of UTF-8 characters. This is done with the admin/cli/mysql_collation.php script that Ken has pointed you to.

If there are still errors when you go to Language customisation try enabling debugging, hopefully there will be more details with the error. Also, let us know what database software you have (MySQL or MariaDB), and which version.

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

Re: Language customisation Error writing to database after updating to 4.0

by martin smith -
Thanks for that, it worked