Webserver: Apache/2.4.34
PHP: 7.3.33
MySQL: Distrib 5.7.24
Moodle Version: 3.7.2+ (Build: 20190927)
Debugging: Enabled at Developer verbosity
Error Message: The following error appears with debugging after attempting to create a new user. As far as I am aware, there are no other issues.
Debug info: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'utf8'
SELECT 'x' FROM mdl_user WHERE LOWER(email) COLLATE utf8mb4_bin = LOWER(?) AND mnethostid = ? AND id <> ? LIMIT 0, 1
[array (
0 => 'mili@uhtasi.org',
1 => '1',
2 => -1,
)]
Error code: dmlreadexception
Stack trace:
- line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
- line 1186 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
- line 1918 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_recordset_sql()
- line 1903 of /lib/dml/moodle_database.php: call to moodle_database->record_exists_sql()
- line 310 of /user/editadvanced_form.php: call to moodle_database->record_exists_select()
- line 607 of /lib/formslib.php: call to user_editadvanced_form->validation()
- line 543 of /lib/formslib.php: call to moodleform->validate_defined_fields()
- line 653 of /lib/formslib.php: call to moodleform->is_validated()
- line 171 of /user/editadvanced.php: call to moodleform->get_data()
MySQL my.cnf file:
[client-server]
# MOODLE Added MySQL full unicode support
[client]
default-character-set = utf8mb4
#
# This group is read by the server
#
[mysqld]
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# MOODLE Added MySQL full unicode support
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake
# MOODLE Added MySQL full unicode support
[mysql]
default-character-set = utf8mb4
#
# include all files from the config directory
#
!includedir /etc/opt/rh/rh-mysql57/my.cnf.d
Here are the following steps I've followed to try and fix the issues:
- Check the Moodle conf.php and ensured that 'dbcollation' => 'utf8mb4_unicode_ci' is included.
- Reviewed the my.cnf file to confirm the recommended collation settings were there.
- Run the admin/cli/mysql_collation.php. This resulted in errors below:
mdl_tag - NO CHANGE
name - Default exception handler: DDL sql execution error Debug: Duplicate entry '1-yet' for key 'mdl_tag_tagnam_uix'
ALTER TABLE mdl_tag
MODIFY COLUMN name varchar(255)
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''
Error code: ddlexecuteerror
* line 492 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown
* line 1072 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 203 of /admin/cli/mysql_collation.php: call to mysqli_native_moodle_database->change_database_structure()
!!! DDL sql execution error !!!
!! Duplicate entry '1-yet' for key 'mdl_tag_tagnam_uix'
ALTER TABLE mdl_tag
MODIFY COLUMN name varchar(255)
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''
Error code: ddlexecuteerror !!
!! Stack trace: * line 492 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown
* line 1072 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 203 of /admin/cli/mysql_collation.php: call to mysqli_native_moodle_database->change_database_structure()
!!
I understand there seems to be a mismatch in the collation that Moodle has in configuration and what is presented in the database. I have looked through the forum and have found others with similar if not that same issues. I am not a DB admin and wondering if there is anything I can do to fix this?Thank you for any help or comments in advance.
