2023-02-15 20:08:04 +00:00
|
|
|
##################################################################################
|
|
|
|
# Note:
|
|
|
|
# =====
|
|
|
|
# The default installation of the MySQL/MariaDB database provides
|
2023-02-16 21:48:55 +00:00
|
|
|
# for the use of the utf8mb4_bin collation.
|
|
|
|
# With this setting characters up to 4 bytes long (e.g. emojis) can be stored.
|
|
|
|
#
|
|
|
|
# If the MySQL/MariaDB version used does not offer utf8mb4 for some reason, utf8
|
|
|
|
# can be used instead.
|
|
|
|
# In this case the MySQL/MariaDB database would be created with the
|
2023-02-15 20:08:04 +00:00
|
|
|
# following statement:
|
|
|
|
#
|
2023-02-16 21:48:55 +00:00
|
|
|
# CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
2023-02-15 20:08:04 +00:00
|
|
|
#
|
|
|
|
# instead of the statement:
|
|
|
|
#
|
2023-02-16 21:48:55 +00:00
|
|
|
# CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
|
2023-02-15 20:08:04 +00:00
|
|
|
#
|
|
|
|
# shown in the first line below.
|
|
|
|
#
|
|
|
|
##################################################################################
|
2023-02-16 21:48:55 +00:00
|
|
|
CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
|
2007-12-30 21:51:16 +00:00
|
|
|
CREATE USER 'fhemuser'@'%' IDENTIFIED BY 'fhempassword';
|
2018-02-22 08:43:10 +00:00
|
|
|
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));
|
2016-09-05 07:02:35 +00:00
|
|
|
CREATE TABLE `fhem`.`current` (TIMESTAMP TIMESTAMP, DEVICE varchar(64), TYPE varchar(64), EVENT varchar(512), READING varchar(64), VALUE varchar(128), UNIT varchar(32));
|
2013-05-18 17:08:13 +00:00
|
|
|
GRANT SELECT, INSERT, DELETE, UPDATE ON `fhem`.* TO 'fhemuser'@'%';
|
2019-01-29 22:07:13 +00:00
|
|
|
CREATE INDEX Search_Idx ON `fhem`.`history` (DEVICE, READING, TIMESTAMP) USING BTREE;
|
2007-12-30 21:51:16 +00:00
|
|
|
|