So here are my bozo findings for mysql/MariaDB commands:
- After login show the databases:
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| openhab |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]>
- Connect to database:
MariaDB [(none)]> use openhab;
Database changed
MariaDB [openhab]>
See that the identifier in the [ ] changes from [(none)] to [openhab]
- Show the tables of the database
MariaDB [openhab]> show tables;
+-------------------+
| Tables_in_openhab |
+-------------------+
| Item1 |
| Item10 |
| Item100 |
| Item101 |
| Item102 |
| Item103 |
| Item104 |
| Item105 |
| Item106 |
| Item107 |
| Item108 |
| Item109 |
| Item11 |
...
| Item97 |
| Item98 |
| Item99 |
| Items |
+-------------------+
127 rows in set (0.00 sec)
MariaDB [openhab]>
- Find out the mapping between ItemId and ItemName looking into table Items
MariaDB [openhab]> select * from Items;
+--------+------------------------------------------------+
| ItemId | ItemName |
+--------+------------------------------------------------+
| 1 | aktFD3CegWZTbatt |
...
| 125 | minGraphValue |
| 126 | maxGraphValue |
+--------+------------------------------------------------+
126 rows in set (0.03 sec)
MariaDB [openhab]>
- a) Show all data stored for Item126 = ItemName: maxGraphValue
MariaDB [openhab]> select * from Item126;
+---------------------+-------+
| Time | Value |
+---------------------+-------+
| 2018-09-16 20:23:01 | 2.2 |
| 2018-09-16 21:54:51 | 2.2 |
| 2018-09-16 22:13:26 | 2.2 |
+---------------------+-------+
3 rows in set (0.00 sec)
MariaDB [openhab]>
- b) Show stored data of specific date and time for Item126 = ItemName: maxGraphValue
select * from Item126 where Time = "2018-09-16 20:23:01";
+---------------------+-------+
| Time | Value |
+---------------------+-------+
| 2018-09-16 20:23:01 | 2.2 |
+---------------------+-------+
1 row in set (0.00 sec)
MariaDB [openhab]>
- a) Delete all data from table Item126 = ItemName: maxGraphValue
MariaDB [openhab]> delete from Item126;
MariaDB [openhab]> select * from Item126;
Empty set (0.00 sec)
MariaDB [openhab]>
- b) Delete only specific value from specific date and time from Item126 = ItemName: maxGraphValue
MariaDB [openhab]> delete from Item126 where Time = "2018-09-16 20:23:01";
Query OK, 1 row affected (0.06 sec)
MariaDB [openhab]>
MariaDB [openhab]> select * from Item126;
+---------------------+-------+
| Time | Value |
+---------------------+-------+
| 2018-09-16 21:54:51 | 2.2 |
| 2018-09-16 22:13:26 | 2.2 |
+---------------------+-------+
2 rows in set (0.00 sec)
MariaDB [openhab]>
- Insert data into table Item126 = ItemName: maxGraphValue
MariaDB [openhab]> insert into Item126 (Time, Value) values ("2018-09-15 15:15:15", "1.5");
Query OK, 1 row affected (0.04 sec)
MariaDB [openhab]>
MariaDB [openhab]> select * from Item126;
+---------------------+-------+
| Time | Value |
+---------------------+-------+
| 2018-09-15 15:15:15 | 1.5 |
| 2018-09-16 20:23:01 | 2.2 |
| 2018-09-16 21:54:51 | 2.2 |
| 2018-09-16 22:13:26 | 2.2 |
+---------------------+-------+
4 rows in set (0.00 sec)
MariaDB [openhab]>
- Change/Update data of table Item126 = ItemName: maxGraphValue
update Item126 set value = "2.2" where Time = "2018-09-15 15:15:15";
Query OK, 1 row affected (0.04 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [openhab]>
MariaDB [openhab]> select * from Item126;
+---------------------+-------+
| Time | Value |
+---------------------+-------+
| 2018-09-15 15:15:15 | 2.2 |
| 2018-09-16 20:23:01 | 2.2 |
| 2018-09-16 21:54:51 | 2.2 |
| 2018-09-16 22:13:26 | 2.2 |
+---------------------+-------+
4 rows in set (0.00 sec)
MariaDB [openhab]>
So, here are the basics that I found quickly and which represent my use case above to find out the mapping of the item names to the item ids and where and how they are stored. You can now update specific item values at specific dates and therefore correct wrong data.
I will update this topic with new helpful commands if I have to find them
And anyone is kindly invited to post his helpful commands to change/update/list/alter the data stored in mysql respectively MariaDB !!!