MySQL on Raspberry Pi

I’ve wanted to have a local and always running database to play with for a while and though cloud databases are interesting and appealing for a variety of reasons, my already documented love of the Raspberry Pi led to the inevitable conclusion that I’d use one as a database server. While this isn’t a surprising turn of events, what was surprising is how disgustingly easy it was to get up and running very quickly.

My Plex server has been in place for a good while now, dutifully serving up media that might otherwise be forgotten or unavailable elsewhere, but it’s not taxed in terms of usage so it was the logical candidate for double jobbing as a DB server too. MySQL was the choice of weapon for an RDBMS for all the reasons that make it such a popular choice for web applications everywhere.

The install process was made simple by the fact that Ubuntu is the OS on my Raspberry Pi, meaning that the MySQL install was as easy as:

sudo apt install mysql-server

With MySQL on board all that remained to get up and running was to configure access by enabling remote (non-localhost) connections and creating a user that has the ability to connect from a remote client machine. With those steps done it was over to MySQL Workbench to test the connection.

All very simple and straightforward, with only one little configuration change needed to accommodate the unusual server hardware and that was to move the location of the datafiles off the SD card the Raspberry Pi uses for primary storage and onto the SSD drive I’ve been using for media files for the Plex system.

The Raspberry Pi provides wonderful opportunities to try out things very quickly, even odd ideas like running database servers on what would normally be considered under-powered hardware for such a task. All in all, this task took less than an hour from start to finish, though the bigger job of putting some useful data into the database will, I suspect, take much longer.

A Quick Raspberry Pi Project

Since about 2015 or so, it seems like there are always Raspberry Pi’s lying around the place, at work and home, just waiting for some project to come along to put them to use.

One of the Pi’s looking for a job as part of my home lab has found just itself retasked as a Plex Media Server following a very simple process.

  • A new Operating System was written onto the SDCard, this time out the OS chosen was the Raspberry Pi variant of Ubuntu Server order to have a more consistent experience across systems being used lately.
  • Once up and running and fully patched, the Plex repo was added and the Media Server installed via apt.
  • Directories were added to host the media library and the Plex configuration ran. Once complete it was a simple matter of connecting the TV to the new media server via the Plex app and enjoying the content I had that was driving this little endeavour in the first place.

I heard it said recently that a Raspberry Pi with decent enough storage can be purchased for less then the price of running an EC2 instance for a year, so when it fits the use case a Pi can be a great solution and even in the age of cloud there are still times when it’s better to run locally (streaming dodgy media being a classic).

https://linuxize.com/post/how-to-install-plex-media-server-on-ubuntu-20-04/

https://www.plex.tv/