I am new to OpenHAB and have setup my system running on a raspberry pi. everything is working fine, I get values from the homematic binding, can control the setvalues, even the mysql binding is working fine and data is stored on mySQL database located in the NAS - as long as I start openHAB with
sudo ./start.sh
When I start OpenHAB as service following this tutorial
OpenHAB starts but the mySQL binding is not working probably. I get the error:
Failed connecting to the SQL database using: driverClass=com.mysql.jdbc.Driver,
url=jdbc:mysql://192.168.178.69:3306/OpenHAB, user=OpenHAB, password=*********
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Any ideas how I can fix this problem? I guess it is a rights problem, isn’t it? I already tried to set the permisions of several files and folders to ‘pi’ using this command:
sudo chown -hR pi:pi /openhab/<Folder or file that should be changed>
If you are running on a Pi, it would be better to install using apt-get or using openHABian instead of manually installing. This should clear up any inconsistencies in rights.
The error you are getting points at a networking rights problem, not a file rights problem.
NOTE: those scripts appear to run OH as the root user, not pi.
Does that mean that running OpenHAB as service does not have the right to access my NAS where the MySQL database is located? As written, when running OpenHAB with
everything is working probably. There are no errors even if I turn logging of MySQL to TRACE.
Do you have a suggestion how to check that? I am absolutely not familiar with those kind of scripts used to run OpenHAB as service.
Either OH doesn’t have permission to talk to MySQL over the network or MySQL is refusing the connection from OH.
I can’t answer how or provide any recommendation except to use openHABian or use the apt-get installation. That will put everything in a known good configuration with regards to file and folder permissions and such.