MySQL for the Internet of Things

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

However, the really nice part is the pcDuino’s onboard bootable operating system is a version of
Ubuntu 12. This means it will behave similarly to a full installation of Ubuntu. Indeed, as a regular Ubuntu
user (second choice to Mac OS X), I found myself right at home on the pcDuino, especially when I use my
Lapdock connected to the pcDuino.
That is, with the pcDuino connected to a monitor, keyboard, and mouse, it operates very much the
same way as a laptop. It’s nearly as fast too! Plus, the onboard Wi-Fi capabilities of the pcDuino 3B make
using the board convenient (no Ethernet cable strung across the room).
Since the pcDuino runs Ubuntu, installing MySQL on a pcDuino is the same process as installing
MySQL on most any other Ubuntu machine. You can even use the same documentation and examples found
elsewhere on the Internet. For pcDuino-specific documentation, see http://linksprite.com/?page_id=874.


■Tip the default user for the pcduino is ubuntu with password ubuntu.


Installing MySQL


The MySQL installation on the pcDuino requires the following commands. We begin with updating the
packages and package headers as follows:


$ sudo apt-get update


Next, we install MySQL with the following command:

$ sudo apt-get install mysql-server


You will have to select a root user password twice during the install, but that’s it! All you have left to do is
configure MySQL to your needs. For example, you may want to edit the my.cnf file and set up your databases
as described in the previous chapter.


Configuring the Hard Drive


Configuring the hard drive on the pcDuino is, once again, similar to the other platforms. Since the platform
is a bit different, I will walk you through the process.
Begin by plugging the USB drive into the USB port. When the drive is recognized (the access LED
may blink a few times and then go solid), execute fdisk much like we did on the Raspberry Pi to create a
partition, mkfs to format, and then mount the drive. Finally, set up the drive using the same commands as
we used on the Raspberry Pi to make the mount persistent and transfer the MySQL database datadir to the
drive as shown previously.


Intel Galileo


The Intel Galileo, sister board to the Intel Einstein platform, is another board that includes headers that
accept Arduino shields. Like the pcDuino and the newer Arduino boards that run a Linux operating system
such as the Yun, the Intel Galileo provides access to the Arduino either from Linux or via a serial connection
to your desktop computer. Thus, like the pcDuino, you can use it to write Arduino sketches as well as an
embedded node in your IOT solution.

Free download pdf