It looks like $CFG->dboptions['dbcollation'] in config.php is utf8_bin. Hopefully you just need to change this to utf8mb4_unicode_ci:
$CFG->dboptions = array (
⋮
'dbcollation' => 'utf8mb4_unicode_ci',
);
There are two character set/collation combinations Moodle supports with MySQL (and MariaDB):
- character set utf8mb4 with collation utf8mb4_unicode_ci. This is the recommended setting supporting the full Unicode character set but some servers still don't support the larger index size this needs in which case they must use:
- character set utf8 with collation utf8_unicode_ci. This works but has some restrictions, notably that trying to use emojis will result in a database error.