[13:41:22] openhabian@openHABianPi:~$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> GRANT ALL ON *.* TO 'openhab'@'localhost';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
2018-07-19 13:43:19.729 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Connection is not valid!
2018-07-19 13:43:19.733 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Connection is not valid!
2018-07-19 13:43:19.741 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Error count exceeded 2. Disconnecting database.
==> /var/log/openhab2/events.log <==
2018-07-19 13:43:19.749 [vent.ItemStateChangedEvent] - bathroom changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2018-07-19 13:43:19.753 [WARN ] [sql.internal.MysqlPersistenceService] - mySQL: No connection to database. Cannot persist item 'bathroom (Type=SwitchItem, State=ON)'! Will retry connecting to database when error count:2 equals errReconnectThreshold:2
no need. it seems that there are no old/wrong parameters in there.
I canât pinpoint the problemâŠ
you have a username/password combo that seem to be working ok (and you can login to mysql using them)
for some reason the persistence addon doesnât want to connect to the MySQL serviceâŠ
Refreshed all installation: binding, mysql.
Refresh all files: persistence, mysql.cfg
Iâve got the same error but one time only (after: sudo systemctl restart mysql), not each time I toggle ON/OFF some buttons. Maybe could be that a hint to follow?
2018-11-26 14:53:17.796 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Connection is not valid!
and
2018-11-26 14:54:33.941 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Azimuth' in database with statement 'INSERT INTO Item4 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': No operations allowed after connection closed.
pid=org.openhab.mysql
# the database url like 'jdbc:mysql://<host>:<port>/<database>' (without quotes)
url=jdbc:mysql://localhost:3306/OpenHAB
# the database user
user=openhab
# the database password
password=openhab
# the reconnection counter
#reconnectCnt=
# the connection timeout (in seconds)
#waitTimeout=
# Use MySQL Server time to store item values (=false) or use openHAB Server time (=true).
# For new installations, its recommend to set "localtime=true".
# (optional, defaults to false)
#localtime=true
Okay, I think that may have fixed it, Iâm getting some different errors now, but not as bad?
018-11-26 15:09:46.418 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not create table for item 'TimePeriodOfDay' with statement 'CREATE TABLE Item37 (Time DATETIME, Value VARCHAR(20000), PRIMARY KEY(Time));': Column length too big for column 'Value' (max = 16383); use BLOB or TEXT instead
2018-11-26 15:09:46.421 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Item 'TimePeriodOfDay' was not added to the table - removing index
2018-11-26 15:09:46.431 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'TimePeriodOfDay' in database with statement 'INSERT INTO Item37 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'OpenHAB.Item37' doesn't exist