openHAB & persistence setup

Hello, I’ve been trying to setup a persistence service for openhab on my raspberry pi. I folllowed this tutorial: How to setup MySQL persistence in a few minutes. Step by step
I have installed the persistence addon with the UI of openhab.
I Then installed mariadb-server and create a database. I also added the user and granted privileges just like he described. I set up the cfg file through the UI on openhab (with the exception of the reconnection counter because i couldn’t find that).
I also have a file named jdbc.persist like explained.
Now when I connect to mariaDB and use the right database I get the following response:
Empty set (0.001 sec)

I am aso not sure if the URL for the database should be the local host one or the one of my raspberry pi. When i try to connect to the database i get following response:
openhabian@openhabian:/ $ mysql -u openhab -p -h localhost OpenHAB
Enter password:
ERROR 1044 (42000): Access denied for user ‘openhab’@‘localhost’ to database ‘OpenHAB’
openhabian@openhabian:/ $ mysql -u openhab -p -h 192.168.1.68 OpenHAB
Enter password:
ERROR 2002 (HY000): Can’t connect to MySQL server on ‘192.168.1.68’ (115)
openhabian@openhabian:/ $

Could anyone help please?

Both should work as long as the service runs on both addresses and if db user openhab is granted privileges to connect and what ever other rights are required.

With

sudo netstat -tulpn

you can check which ports are open and which services run on these ports.
You should be able to find the DB process and from that check if it is listening on localhost or on the IP.

Thanks for that! I think I fixed it. It had something to do with the mariaDB addon. When I downloaded it disappeared and I couldn’t even find it through the search feature. I suddenly found it again yesterday and it wasn’t downloaded anymore, so I downloaded it again and now everything works!

1 Like