MODBUS to MySQL: Write MODBUS values to the MySQL database
The configuration process for MySQL is similar to the article "How to write data to MSSQL." Only the 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.
Fig. 1 Driver section
2. The structure of a table in the database will look like this:
CREATE TABLE `modbus_data_2` (
`REC_ID` int(11) NOT NULL AUTO_INCREMENT,
`TIMESTAMP` datetime NOT NULL,
`ITEM1` varchar(30) DEFAULT NULL,
`ITEM2` varchar(30) DEFAULT NULL,
PRIMARY KEY (`REC_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
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 previous tutorial for MS SQL: "Writing MODBUS values to MS SQL."
5. During the binding process, you should consider that the names of the table and its columns are case-sensitive in MySQL.
Related articles: MODBUS to MySQL: Write MODBUS values to the MySQL database
MODBUS RTU, MODBUS ASCII, MODBUS/TCP
- MODBUS power meter data logging (easy method)
- Sunspec-compatible MODBUS power meters, inverters (easy method)
- MODBUS RTU/TCP polling: Configuring master station (MODBUS RTU, MODBUS TCP, requests, response items).
- MODBUS poll: How to make sure that the application sends requests and receives responses?
- MODBUS poll: How to view register values, not raw MODBUS packets?
- MODBUS polling: How to make sure that the application correctly interprets the responses received from the device?
- MODBUS polling: How to view MODBUS register values in a more easy-to-grasp form (graphs, indicators, etc.)?
- MODBUS: How to combine the data of two requests?
- MODBUS: What is the right way to poll multiple devices?
- Copy settings from Simply MODBUS RTU Master to our Modbus Data Logger.
- Copy settings from the MODBUS Poll utility.
- Controlling PLC coil registers status using MODBUS TCP (MODBUS data parser, custom scripts, events generating, and handling).
- MODBUS to MSSQL: Write MODBUS registers to separate columns
- MODBUS to MySQL: Write MODBUS values to the MySQL database
- MODBUS to a database: Writing MODBUS RTU/TCP values to a database
- MODBUS to a database: Write data to two different tables.
- MODBUS to a database: Write data to two different databases, making a complete copy.
- Sentron PAC 3200: MODBUS TCP Data Logging
- Write data to a MODBUS device
- SQL to MODBUS: Send data from a SQL database to MODBUS.
- MODBUS TCP ↔ MODBUS RTU real-time conversion.
BACNET/IP
IEC 62056-21
- IEC 62056-21 power meter data logging (Iskra Emco, Satec, Landis+Gyr)