OSX Persistence Help

I’m just getting started with openHAB on OSX though most of the stuff for it was written for a raspberry pi it seems like.

I’m new to terminal and Unix language. I’m hoping someone can point me to tutorials or documentation on things like persistence for OSX.

I’ve tried setting up MySQL for persistence and have created a DB and user/pw and configured the MySQL file and created a persistence file, though in habmin nothing is written in the persistence section.

Hi,

Persistence should work similarly on OSX as on a Raspberry Pi… perhaps we can start with a little troubleshooting:

I assume you’ve tried restarting openHAB… I recommend taking a look in your log file to see if there’s anything of interest. You can find it in your openhab installation under userdata/logs/openhab.log. Also, which persistence module did you install? JDBC Persistence MySQL or MySQL Persistence?

Bill

I installed MySql Persistence. Access denied for user ‘openhab’@‘localhost’ (using password: YES) is the error in the logs. Weird because I set the user and password to what it is attempting.

Well, I’d suggest trying a few things… first, I’d try changing the username in the persistence configuration and restarting. What you change it to doesn’t really matter, we’re just trying to verify that it’s using the properties you think it is.

I’d also try logging in using the mysql command line client…

mysql -u username -p password -h localhost databasename

I’ve been using mysql for longer than I care to admit and still spend a fair amount of time troubleshooting permission problems. Hopefully these suggestions will get you closer to solving the problem… feel free to report back on your progress!

Since I’m on a mac I wonder if the syntax is incorrect in my cfg file?

# 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=XXXXX

# 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

ERROR 1045 (28000): Access denied for user ‘openhab’@‘localhost’ (using password: YES)

Also I had to add -D hostname to the mysql command when trying to log in.

Okay so I changed my persistence from MySql to the JDBC MySql persistence add on and now it seems to be working. I believe this means that the url I was using in my mysql.cfg file was incorrect?

Your URL looks okay, I don’t think the problem is mac specific. The mysql URL allows specifying the username and password; it’s possible there’s a glitch in the older persistence bundle that wasn’t setting the username/password properly.

Feel free to drop a note back if things end up not working properly!