From d57e0b8313012470d8957ef2d7979735af92fe0c Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Wed, 15 Feb 2023 20:08:04 +0000 Subject: [PATCH] db_create_mysql.sql: note for utf8mb4 (MySQL) git-svn-id: https://svn.fhem.de/fhem/trunk@27231 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/dblog/db_create_mysql.sql | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/fhem/contrib/dblog/db_create_mysql.sql b/fhem/contrib/dblog/db_create_mysql.sql index 59c353c3d..290b7d8ad 100644 --- a/fhem/contrib/dblog/db_create_mysql.sql +++ b/fhem/contrib/dblog/db_create_mysql.sql @@ -1,3 +1,26 @@ +################################################################################## +# Note: +# ===== +# The default installation of the MySQL/MariaDB database provides +# for the use of the utf8_bin collation. +# With this setting, characters up to 3 bytes long can be stored, +# which is generally sufficient for FHEM. +# However, if characters with a length of 4 bytes (e.g. emojis) +# are to be stored in the database, the utf8mb4 +# character set must be used. +# +# in this case the MySQL/MariaDB database would be created with the +# following statement: +# +# CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +# +# instead of the statement: +# +# CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; +# +# shown in the first line below. +# +################################################################################## CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; CREATE USER 'fhemuser'@'%' IDENTIFIED BY 'fhempassword'; CREATE TABLE `fhem`.`history` (TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, DEVICE varchar(64), TYPE varchar(64), EVENT varchar(512), READING varchar(64), VALUE varchar(128), UNIT varchar(32));