Advanced Serial Data Logger

Trust In Confidence!

For Windows 2000 - Windows 10 (2019) (incl. Server, x86 and x64). Latest version: 4.4.3 build 911. .


MODBUS to MySQL: Writing MODBUS values to MySQL database

Download a Free Trial Version. It allows you to try all features! Plugins can be downloaded separately here

Configuring how to write MODBUS data to a MySQL database is very much similar to configuring how to write data to MSSQL. Only main differences are described in this manual.

1. Download and install the 32-bit version of MySQL ODBC Connector (the ODBC driver) for MySQL from mysql.org.

Driver section
Fig. 1 Driver section

2. The structure of a table in the database will look like this:


CREATE TABLE [dbo].[modbus_data_2](
   [REC_ID] [int] IDENTITY(1,1) NOT NULL,
   [TIMESTAMP] [datetime] NULL,
   [ITEM1] [nchar](30) NULL,
   [ITEM2] [nchar](30) NULL
) ON [PRIMARY]

If you specify any other data type than String for ITEM1 or ITEM2 in the MODBUS settings, you should create the columns of the corresponding types while creating a table.

3. Create an ODBC data source for your MySQL database.

4 Follow steps #1-9 from the previos tutorial for MS SQL: "Writing MODBUS values to MS SQL".

5. During "Binding", you should take into account that the names of the table and its columns are case-sensitive in MySQL.

Related articles:

MODBUS RTU, MODBUS ASCII, MODBUS/TCP

IEC 62056-21