diff --git a/components/ILIAS/Database/classes/Setup/ilDatabaseCreatedObjective.php b/components/ILIAS/Database/classes/Setup/ilDatabaseCreatedObjective.php index 432aaecef82b..feeeee269f51 100755 --- a/components/ILIAS/Database/classes/Setup/ilDatabaseCreatedObjective.php +++ b/components/ILIAS/Database/classes/Setup/ilDatabaseCreatedObjective.php @@ -59,7 +59,8 @@ public function achieve(Environment $environment): Environment $db = \ilDBWrapperFactory::getWrapper($this->config->getType()); $db->initFromIniFile($c->toMockIniFile()); - if (!$db->createDatabase($c->getDatabase(), "utf8", $c->getCollation())) { + $charset = ilDBConstants::isUTF8MB4Collation($c->getCollation()) ? 'utf8mb4' : 'utf8'; + if (!$db->createDatabase($c->getDatabase(), $charset, $c->getCollation())) { throw new UnachievableException( "Database cannot be created." ); diff --git a/components/ILIAS/Database/classes/Setup/ilDatabaseSetupConfig.php b/components/ILIAS/Database/classes/Setup/ilDatabaseSetupConfig.php index 226b7d2f0213..cddaa7393cdd 100755 --- a/components/ILIAS/Database/classes/Setup/ilDatabaseSetupConfig.php +++ b/components/ILIAS/Database/classes/Setup/ilDatabaseSetupConfig.php @@ -23,7 +23,7 @@ class ilDatabaseSetupConfig implements Config { - public const DEFAULT_COLLATION = "utf8_general_ci"; + public const DEFAULT_COLLATION = \ilDBConstants::MYSQL_COLLATION_UTF8MB4_520; public const DEFAULT_PATH_TO_DB_DUMP = "./components/ILIAS/Database/sql/ilias3.sql"; protected string $type; diff --git a/docs/configuration/install.md b/docs/configuration/install.md index a39a97210008..db54cac738b4 100755 --- a/docs/configuration/install.md +++ b/docs/configuration/install.md @@ -254,15 +254,11 @@ On Debian/Ubuntu execute: apt install mariadb-server ``` -> [!NOTE] -> Please note that installing ILIAS in utf8mb4-collations is currently not supported! -> ILIAS supports utf8-collations with 3 bytes per character, such as `utf8_general_ci`, only. - We **strongly recommend** using MariaDB with the following settings: * InnoDB storage engine (default) -* `character-set-server` = `utf8mb3` -* `collation-server` = `utf8mb3_general_ci` +* `character-set-server` = `utf8mb4` +* `collation-server` = `utf8mb4_unicode_520_ci` * `join_buffer_size` > `128K` * `table_open_cache` > `400` * `innodb_buffer_pool_size` > `2G` (depending on DB size) @@ -279,7 +275,7 @@ systemctl restart mariadb.service We recommend creating a dedicated database user for ILIAS: ```shell -mysql -e "CREATE DATABASE ilias CHARACTER SET utf8 COLLATE utf8_general_ci;" +mysql -e "CREATE DATABASE ilias CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;" mysql -e "CREATE USER 'ilias'@'localhost' IDENTIFIED BY '';" mysql -e "GRANT LOCK TABLES on *.* TO 'ilias'@'localhost';" mysql -e "GRANT ALL PRIVILEGES ON ilias.* TO 'ilias'@'localhost';"