[SOLVED] Mysql persistence doesn't work - DB table is empty - Unable to find table ERROR

Tags: #<Tag:0x00007f616da03608> #<Tag:0x00007f616da03400> #<Tag:0x00007f616da02ff0>
  • Platform information:
    • Hardware: Raspberry Pi
    • OS: Raspbian 10
    • Java Runtime Environment: Zulu Embedded 8.25.0.76-linux-aarch32hf, build 1.8.0_152-b76
    • openHAB version: 2.5.1-2
  • Issue of the topic: I have tried to setup mysql persistence but without success. Log file shows what the problem is. Everything is setup according to this. The mysql database OpenHAB exists, as well as the “openhab” user (with the correct password). There is a table called Items, but it is empty.
  • Please post configurations (if applicable):
    • Items configuration related to the issue
    • Sitemap configuration related to the issue: N/A
    • Rules code related to the issue: N/A
    • Services configuration related to the issue

mysql.cfg:

# the database url like 'jdbc:mysql://<host>:<port>/<database>' (without quotes)
url=jdbc:mysql://127.0.0.1:3306/OpenHAB

# the database user
user=openhab

# the database password
password=xxxx

# the reconnection counter
reconnectCnt=1

# the connection timeout (in seconds)
waitTimeout=28800

# 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

mysql.persist:

Strategies {
  default = everyUpdate
}

Items { *: strategy = everyUpdate }
  • If logs where generated please post these here using code fences:
==> /var/log/openhab2/openhab.log <==
2020-01-24 22:16:20.024 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.
2020-01-24 22:16:20.042 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.
2020-01-24 22:16:20.058 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.
2020-01-24 22:28:19.743 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.
2020-01-24 22:28:19.765 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.
2020-01-24 22:28:19.800 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.
2020-01-24 22:40:19.708 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.
2020-01-24 22:40:19.729 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.
2020-01-24 22:40:19.763 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'ESP8266Sensor_ESP8266Pressure'.

Try renaming this file to jdbc.persist

Ok, I am embarrassed… but the problem was that I had put the .persist file in the service folder and not the persistence one…

1 Like