Started getting this on a site after upgrading it from 4.1.16 to 4.5.5. MariaDB 10.11.6, PHP 8.1.31.
Execute scheduled task: Unused H5P files cleanup (core\task\h5p_clean_orphaned_records_task) ... started 13:56:45. Current memory use 14.2 MB. ... used 1 dbqueries ... used 0.012227058410645 seconds Scheduled task failed: Unused H5P files cleanup (core\task\h5p_clean_orphaned_records_task),Error reading from database (Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '=' SELECT h5p.id FROM mdl_h5p h5p LEFT JOIN mdl_files f ON f.pathnamehash = h5p.pathnamehash WHERE f.pathnamehash IS NULL [array ( )]) Debug info: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '=' SELECT h5p.id FROM mdl_h5p h5p LEFT JOIN mdl_files f ON f.pathnamehash = h5p.pathnamehash WHERE f.pathnamehash IS NULL [array ( )] Backtrace: * line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end() * line 1303 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end() * line 49 of /lib/classes/task/h5p_clean_orphaned_records_task.php: call to mysqli_native_moodle_database->get_recordset_sql() * line 410 of /lib/classes/cron.php: call to core\task\h5p_clean_orphaned_records_task->execute() * line 194 of /admin/cli/scheduled_task.php: call to core\cron::run_inner_scheduled_task()
The problem never happened in all the years before upgrade.
$CFG->dbtype = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'xxxxxxxx';
$CFG->dbuser = 'xxxxxx';
$CFG->dbpass = 'xxxxxxx';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => '',
'dbsocket' => '',
'dbcollation' => 'utf8mb4_general_ci',
);
before and after.