-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
3.7.5, 3.8.2
-
None
-
MySQL
-
MOODLE_37_STABLE, MOODLE_38_STABLE
-
m39_
MDL-68531_MySQL_Tool_Collation_Hyphen_DB_Name -
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 ********:
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. The Database name must be escaped with ``.
- has been marked as being related by
-
MDL-68536 Early access to $CFG->branch in core_plugin_manager::instance()->all_plugins_ok
-
- Closed
-
- will be (partly) resolved by
-
MDL-70181 mysql_collation.php fails if prefix is blank
-
- Closed
-
- will help resolve
-
MDL-58729 Full unicode support conversion impractically slow
-
- Closed
-