QuickStart Guide
...
Historian Drivers
MySQL Server Client Driver
11 min
overview to set up and configure this device in litmus edge, you must step 1 obtain the appropriate mysql server connection details step 2 set up the mysql server client device in litmus edge devicehub step 3 configure a tag with defined sql queries step 1 obtain mysql server connection details to connect to mysql server, you require the following connection information find these on the mysql server or from the appropriate server admin address ip/domain for the mysql server port port to connect to the mysql server (default 3306) database mysql database name username and password authentication credentials to connect to mysql server step 2 set up the mysql server client device in litmus edge devicehub configure the following parameters when you docid\ pal6abpzbrimdu9lvgj30 with this driver update default values to the specific setup of your device parameter value type historian driver mysql server client name user defined name for the device in litmus edge description (optional) description of the device address the mysql address you found in step 1 port the mysql port you found in step 1 (default 3306) database name of database in mysql server username username of mysql account password password of mysql account enable tls select enable to secure connection via tls tsl configuration parameter value ca chain enter or upload the mysql server ca chain in pem format client auth select enable to enable mtls certificate when client auth is enabled, enter or upload the client certificate in pem format private key when client auth is enabled enter or upload private key in pem format define additional advanced configuration options for the mysql device by setting advanced to show these settings are optional parameter value request timeout define a request timeout in seconds default 10 seconds connection timeout define a connection timeout in seconds default 5 seconds app name client application id (optional connection identifier) default devicehub step 3 configure a tag with defined sql queries when you docid\ tuy hh0gi8djvot70wroh to the connected device, see the following register table and tag parameters sections you can also docid 8oruw1cmtao49bwbbhwrn see the following additional resources if necessary organize device and tag data by using metadata tag formula variables register table name value types description table multi row value json results in multiple records in json with schema, datatypes and values record single row value json, bool, bytes, float32, float64, int8, int16, int32, int64, string, uint8, uint16, uint32, uint64 returns a single record parsed into the devicehub standard payload tag parameters name select a register name from the drop down list available options depend on the names in the register table value type select a data type from the drop down list available options depend on the register name selected polling interval enter a value in seconds this determines how often the tag should query the mysql server tag name enter a name for the tag description (optional) enter a description for the tag data query enter the desired sql query only publish on change select disabled or enabled from dropdown parse timestamp select column index, column name, or none timestamp value from a specific column index or name is used as the timestamp value in the devicehub payload only available when name is record single row value timestamp index/name define the column index or name from the sql table parse value select between column index, column name or none value from a specific column index or name will be used as the value in the devicehub payload only available when name is record single row value value type defined above must match the sql column datatype value index/name define the column index or name from the sql table tag formula enter a formula for the tag to process the generated data two variables are permitted value (current tag value) and timestamp (current tag unix time in milliseconds) the following math functions are available sin cos sqrt tan power power( x ) performs the operation 10^x log log( x ) is the natural logarithm (the logarithm is in base e ) exp exp( x ) performs the operation e^x only publish on change of value select the checkbox to customize nats messages to publish only when the value parameter changes to a new one change of value only applies to boolean, numeric (such as int or float), and simple string data types it does not apply to complex types, such as json or array poll once topics are not be affected by change of value settings these topics will still only see a single message meta data metadata summarizes basic information about data this feature allows you to define key value pair data for the device output payload later on it can then be used to find, use, and reuse particular instances of data note if you use special characters in meta data key names, the special characters are replaced with underscore characters in the payload this can cause two key names to be combined into one for example, configuring the key names a b and a&\&b will cause only one key name to be created (a b) examples in this example we have the following sql table in our mysql server sql table database otdata table name metrics timestamp id metric name value area line machine 2025 06 18 08 20 000 1 temperature 56 a1 l1 temperature sensor 2025 06 18 08 20 000 2 pressure 500 a1 l3 boiler 2025 06 18 08 20 000 3 power 4000 a1 l4 laser cutter 2025 06 19 08 20 000 4 temperature 53 a1 l1 temperature sensor 2025 06 19 08 20 000 5 pressure 550 a1 l3 boiler 2025 06 19 08 20 000 6 power 4005 a1 l4 laser cutter 2025 06 20 08 20 000 7 temperature 51 a1 l1 temperature sensor 2025 06 20 08 20 000 8 pressure 600 a1 l3 boiler 2025 06 20 08 20 000 9 power 4010 a1 l4 laser cutter tag configuration 1 name table multi row value query select from \[otdata] \[metrics] result { "success" true, "datatype" "json", "timestamp" 1683901823577, "registerid" "dbe0c6d2 a91d 49d1 9cb7 dbf3c6d9c919", "value" { "fields" \["timestamp","id","metric name", "value", "area", "line", "machine" ], "types" \["date","int","varcar","int","varcar","varcar","varcar"], "data" \[ \["2025 06 18 08 20 00 000",1,"temperature", 56, "a1", "l1","temperature sensor"], \["2025 06 18 08 20 00 000",2,"pressure", 500, "a1", "l1","boiler"], \["2025 06 18 08 20 00 000",3,"power", 4000, "a1", "l4","laser cutter"], \["2025 06 18 08 20 00 000",9,"power", 4010, "a1", "l4","laser cutter"], ] }, "deviceid" "7c01e851 fe46 463a 90ec 98aa3f12be09", "tagname" "table all", "devicename" "mssql db", "description" "", "metadata" {} } tag configuration 2 name record single row value value type int query select from \[otdata] \[metrics] parse timestamp column index timestamp index 0 parse value column name value index value result { "success" true, "datatype" "json", "timestamp" 1750407600000, "registerid" "dbe0c6d2 a41d 46d1 2cb7 dbf3c6d9c919", "value" 4010, "deviceid" "7c01e851 fe46 463a 90ec 98aa3f12be09", "tagname" "table last entry", "devicename" "mssql db", "description" "", "metadata" {} }