RRD and mysql example

Create Database
  mysqladmin create weather -u root -p
Grant access to database

The script grantAccess.sql gives access to the weather database that was just created to the weatherDAQ user.

  mysql mysql -u root -p < grantAccess.sql
Create the database tables

createTables.sql

  mysql weather -u root -p < createTables.sql
Readout Software

weatherDAQ.pl

Startup Script Start Database Server and Readout Software

  /etc/initd/mysqld start
  /etc/initd/weatherDAQ.init start

mysql commands
> mysql -u root
mysql> show databases;
+----------+
| Database |
+----------+
| mysql    |
| weather  |
+----------+

mysql> use weather;

mysql> show tables;
+--------------------+
| Tables_in_digitemp |
+--------------------+
| activity           |
| humidity           |
| lightning          |
| pressure           |
| rain               |
| solar              |
| temperature        |
| wind               |
+--------------------+
pbarp> mysql -u root
mysql> use weather;
mysql> select * from temperature;

|  3389 | 2007-08-19 10:52:52 | Exhaust     |      79.59 |
|  3390 | 2007-08-19 10:52:52 | Library     |      72.61 |
|  3391 | 2007-08-19 10:52:52 | Outside     |      65.08 |
|  3392 | 2007-08-19 10:52:52 | Living Room |      67.10 |
+-------+---------------------+-------------+------------+
3392 rows in set (0.00 sec)