Howto clean database openhab2

I want to clean my database with items to start with a clean system.
However I cannot get this done, using the following command from karaf

osgi> smarthome:items clear

does not work en my.openhab is down.

Are there other ways to clean the database ?


Which version of OH 2 are you using?

If you want a completely clean install you can stop openHAB and remove the contents of /ver/lib/openhab2/useradata.

When you start openHAB again that folder will be recreated. Everything configured through PaperUI or Habmin or the Karaf console ends up stored there.

I’m using OH2b4 and want to clean my database (mysql).
Up to now I’ve been playing with the persistence mode (everyMinute, everyChange and others) but decided now to store everyMinute.
Therefore I want to whipe out all ‘old’ data in my database but NOT the items as in my *.items list.


OK, there are two databases. There is the one that OH 2 uses to store configuration and persistence. running smarthome:items clear only clears out the OH 2 configuration database.

In MySQL you probably should just drop the DB and let OH 2 recreate it.

Managing the actual persistence databases is beyond the scope of what OH 2 manages. You have to do that yourself.

One note I will make is the config DB changes so when you upgrade you will likely need to reinstall your bindings and reconfigure everything.