-
Notifications
You must be signed in to change notification settings - Fork 4
MySQL Persistence
Documentation of the MYSQL Persistence Service
This service allows you to persist state updates using the MySQL database. Note that other SQL databases need a separate binding due to incompatibilities between different SQL databases.
This persistence service supports writing information to mysql relational database systems.
For installation of this persistence package please follow the same steps as if you would install a binding.
Additionally, place a persistence file called mysql.persist in the ${openhab.home}/configuration/persistence folder. This has the standard format as described in Persistence.
This persistence service can be configured in the "SQL Persistence Service" section in openhab.cfg.
############################ mySQL Persistence Service ##################################
# the database url like 'jdbc:mysql://<host>:<port>/<user>'
mysql:url=jdbc:mysql://127.0.0.1/openhab
# the database user
mysql:user=<your user here>
# the database password
mysql:password=<your password here>
# the reconnection counter
#mysql:reconnectCnt=
# the connection timeout (in seconds)
#mysql:waitTimeout=
# optional tweaking of mysql datatypes
# example as described in https://github.com/openhab/openhab/issues/710
# mysql:sqltype.string=VARCHAR(20000)
The database location, user and password need to be modified as per your database.
The service will create a mapping table to link each item to a table, and a separate table is generated for each item. The item data tables include the time and data - the data type is dependent on the item type and allows the item state to be recovered back into openHAB in the same way it was stored.
The persistence service should attempt to reconnect to the mySQL server if it detect errors. There are two configuration parameters that can be adjusted to control this -: reconnectCnt - Setting this to 1 will cause the service to close the connection and reconnect if there are any errors. waitTimeout - This sets the number of seconds that mySQL will keep the session open without any transactions. It should default to 8 hours within mySQL, but some implementations may use lower values (possibly as low as 60 seconds) which would cause unnecessary reconnections. This value needs to be set higher than the maximum logging period.
Installation
Community
- Support
- News Archive
- Presentations
- How to Contribute
- IDE Setup
- How to Implement a Binding
- How to Implement an Action
- Projects using openHAB
- User Interfaces
- Classic UI
- iOS Client
- Android Client
- GreenT UI
- CometVisu
- Bindings
- Asterisk Binding
- Astro Binding
- Bluetooth Binding
- Comfo Air Binding
- CUL Binding
- CUPS Binding
- digitalSTROM Binding
- DMX512 Binding
- EnOcean Binding
- Epson Projector Binding
- Exec Binding
- Fritz!Box Binding
- Fritz AHA Binding
- GPIO Binding
- HDAnywhere binding
- Heatmiser Binding
- Homematic Binding
- HTTP Binding
- IHC / ELKO Binding
- Insteon Hub Binding
- Insteon PLM Binding
- Ir-Trans Binding
- KNX Binding
- Koubachi Binding
- MAX!Cube-Binding
- MiLight Binding
- Modbus TCP Binding
- MPD Binding
- MQTT Binding
- MQTTitude binding
- Neohub Binding (Preview)
- Netatmo Binding
- Network Health Binding
- Nibe Heatpump Binding
- Nikobus Binding
- Novelan/Luxtronic Heatpump Binding
- NTP Binding
- One-Wire Binding
- Onkyo AV Receiver Binding
- Open Energy Monitor Binding
- OpenPaths presence detection binding
- OpenSprinkler Binding
- OSGi Configuration Admin Binding
- Philips Hue Binding
- Piface Binding
- Pioneer-AVR-Binding
- Plugwise Binding
- PLCBus Binding
- Pulseaudio Binding
- RFXCOM Binding
- Samsung TV Binding
- Serial Binding
- Snmp Binding
- Squeezebox Binding
- System Info Binding
- Somfy URTSI II Binding
- Sonos Binding
- Swegon ventilation Binding
- TCP/UDP Binding
- Tellstick Binding
- TinkerForge Binding
- VDR Binding
- Velleman-K8055-Binding
- Wake-on-LAN Binding
- Withings Binding
- XBMC Binding
- xPL Binding
- Z-Wave Binding
- Persistence
- db4o Persistence
- rrd4j Persistence
- MySQL Persistence
- MongoDB Persistence
- Sen.Se Persistence
- Cosm Persistence
- Logging Persistence
- Exec Persistence
- MQTT Persistence
- Automation
- Scripts
- Rules
- Actions
- Misc
- REST-API
- Security
- Google Calendar Support
- Twitter Action
- Service Discovery
- Dropbox Bundle
Samples
- Item definitions
- Sitemap definitions
- Binding configurations
- Rules
- REST Examples
- Tips & Tricks
- FAQ
- XSLT Transforms
- Scripts
- Integration with other applications
- Syntax highlighting for external editors
- Update-Scripts
- Samples-Comfo-Air-Binding
- Samples WAC Binding
Release Notes