MySQL for the Internet of Things

(Steven Felgate) #1
Chapter 6 ■ Building low-Cost MysQl data nodes

You can check to see that the database is created by displaying the file structure using the following
command:


$ sudo ls -lsa /media/HDD/mysql


What you should see in the mysql folder is a separate folder for each database. Indeed, you should see
the folder for the new database created represented as the folder testme. Well, there you have it—a new
MySQL database server running on a Raspberry Pi!


What aBOUt OVerheatING?


Concerns about overheating a raspberry pi are mainly for those who attempt overclocking and other
risky modifications; you should worry if your raspberry pi is run continuously. typically you run a
database server 24/7, shutting it down only for maintenance.

if you are concerned about overheating, you can add heat sinks to your raspberry pi’s major
components for a reasonable cost (about $15). however, i have not seen any issues with running a
raspberry pi indefinitely if it is housed in an enclosure that permits heat dissipation and it is placed in
a climate-controlled environment. a definitive answer to this question has been provided by one of the
founders himself (see http://www.youtube.com/watch?v=Sz8NMp4MgG0).

Now that we have our Raspberry Pi configured and MySQL installed and working, let’s now see how we
can connect our devices to the database server for saving our data. But first, let me discuss some alternatives
for the Raspberry Pi.


Other Platforms


While I focused on the Raspberry Pi for demonstrating how to build a low-cost MySQL database server, the
Raspberry Pi isn’t the only choice. Indeed, you can use any number of low-cost computers and embedded
platforms for hosting a MySQL server. In this section, I present three alternatives: the BeagleBone Black,
pcDuino, and Intel Galileo.
While the process is similar on all of these, there are some small differences and other things to
consider. Thus, I present each in the following sections in a condensed overview. Having read the Raspberry
Pi tutorial previously, you should be able to accomplish the following with ease.


BeagleBone Black


Recall from Chapter 3 , the BeagleBone Black is a lower-cost version of the original BeagleBone. It comes
with an onboard bootable Linux operating system preconfigured. Like the Raspberry Pi, it hosts a number of
ports including USB ports for connecting memory devices.
Be sure to connect your BeagleBone Black to your network before powering on. I used the onboard
Ethernet port and found it more than adequate for accessing the board remotely. The only issue you may
have is discovering which IP address your board is using. I recommend using a port scanner. There are many
such applications available for most platforms. Use that IP address and remote into your BeagleBone Black
with ssh root@.


■Note the default root password on the BeagleBone Black is blank.

Free download pdf