Moodle Version: 3.7.5
mariadb: 10.1.44
System: Ubuntu 18.04
I try to convert database encoding from utf8 to utf8mb4 with this manual: https://docs.moodle.org/37/en/MySQL_full_unicode_support
With one Installation no problem with the other I get an error:
/opt/plesk/php/7.3/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
Converting database to 'utf8mb4_unicode_ci' for https://carestream.lernyx.com:
Error: Tried to alter the database with no success. Please try manually changing the database
to the new collation and character set and then run this script again.
I have take a look on the code:
https://github.com/moodle/moodle/blob/master/admin/cli/mysql_collation.php#L122
If i change
$sql = "ALTER DATABASE $CFG->dbname DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation";
to
$sql = "ALTER DATABASE `$CFG->dbname` DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation";
Now it works.
Can somebody of moodle team fix this?