Keywords: Moodle - Google Cloud Platform - How to - Other
I am looking for a way to roll back an encoding update which i assume went wrong. But i am not sure how to do this (if possible) from the terminal. Any help is much appreciated.
When installing a plugin in my freshly deployed moodle stack, i gor the following warning from moodle:
"mysql_full_unicode_support; if this test fails, it indicates a potential problem
The current setup of MySQL or MariaDB is using 'utf8'. This character set does not support four byte characters which include some emoji. Trying to use these characters will result in an error when updating a record, and any information being sent to the database will be lost. Please consider changing your settings to 'utf8mb4'. See the documentation for full details."
I searched this forum and found a similar case here: https://community.bitnami.com/t/howto-utf8mb4-conversion/62787
I ran the first command "mysql_collation.php --collation=utf8mb4_unicode_ci" which was successful. But when executing the second command "ctlscript.sh restart mysql" i got an error "sudo: ctlscript.ls: command not found", and the warning did not go away in moodle. I restarted the server thinking it would also perform the wanted restart of the database, but the warning pesisted in moodle.
I tried to change permission of the script with "chmod 755" as suggested in another forum post, but without any luck.
Having no obvious problems of this moodle warning, i continued setting up my site. But when enabling "Email based self registration" and attempting to register the first user i received "Error reading database". I enabled debugging and made a new attempt. Here is the result:
xDebug info: COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
WHERE LOWER(email) COLLATE utf8_bin = LOWER(?)
AND id IN (SELECT id
WHERE email = ?
AND mnethostid = ?) LIMIT 0, 1
0 => 'firstname.lastname@example.org',
1 => 'email@example.com',
2 => '1',
Error code: dmlreadexception
line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 1212 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 2002 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_recordset_sql()
line 1048 of /lib/authlib.php: call to moodle_database->record_exists_sql()
line 150 of /login/signup_form.php: call to signup_validate_data()
line 615 of /lib/formslib.php: call to login_signup_form->validation()
line 551 of /lib/formslib.php: call to moodleform->validate_defined_fields()
line 661 of /lib/formslib.php: call to moodleform->is_validated()
line 85 of /login/signup.php: call to moodleform->get_data()
I fear it is the encoding update error that is the root cause of this.
What can i do to either properly change encoding to utf8mb4 or to roll back encoding to utf8?