HowTo:mysql

HowTo:mysql - MySQL How To Guide

The mysql module was designed to offer a high level of compatibility with the player, recorder, and collector objects in the tape module. This guide offers a HowTo for implementing mysql interfaces and converting tape I/O to mysql I/O.

Setup the default connection
The default database connects to the server on the localhost (on port 127.0.0.1 or socket name /tmp/mysql.sock) using the database schema gridlabd with the user gridlabd (no password).

To use the default database you must install a MySQL server on the localhost. The installation procedure depends on the host platform and can be found at www.mysql.com. We strongly recommend also installed the MySQL WorkBench to allow administration of the server. Using the workbench you should create a user gridlabd with full control of the schema gridlabd. If you are concerned about the security of this schema, you can also set the password for this user and restrict access to localhost clients only.

A simple mysql recorder
The simple example of a mysql recorder is illustrated by the following example. The module declaration replaces a conventional tape module declaration and the specifications of the object is compatible (although not always identical):

Omitting all specifications for the database object uses the default connection.

If you want to record the values in a different unit than the unit to property you are recording, you must specify the unit with the property. If the property you are are recording also has a unit, the value will be converted automatically as it is sampled: