Buy Percona ServicesBuy Now!

How to Build a Percona Server “Stack” on a Raspberry Pi 3+

 | August 1, 2019 |  Posted In: MySQL, Percona Server for MySQL

Percona installation on Raspberry Pi 3+The blog post How to Compile Percona Server for MySQL 5.7 in Raspberry Pi 3 by Walter Garcia, inspired me to create an updated install of Percona Server for the Raspberry Pi 3+.

This how-to post covers installing from source and being able to use Percona Server for MySQL in any of your maker projects. I have included everything you need to have a complete Percona Server, ready to store data collection for your weather station, your GPS data, or any other project you can think of that would require data collection in a database.

My years of hands-on support of Percona Server enable me to customize the install a bit. I wanted to build a full Percona “Stack” including XtraBackup, and Percona Toolkit.

Hardware and Software

  • Tested on a Raspberry PI 3B and 3B+
  • OS is Raspbian Buster. You can download it here: https://www.raspberrypi.org/downloads/raspbian/
  • I choose the option: Raspbian Buster with Desktop.
  • 64GB SD Card, not required, but would not suggest less than 32GB. For best performance use and SD card that is between 90 – 100MB per sec.

The Step-by-Step Guide

Let’s get on and build!

1. Prep Your Raspberry PI

You will notice I use sudo rather often, even during the make and cmake.

I found that running as the default pi user for the install gave me issues. Using sudo for root based commands is the best practice that I always try to follow.

Create a swapfile. Very much needed for these two compiles.

2. Build Percona Server for MySQL

This will take about 3.5 to 4 hours to run.

Download percona-server 5.7.26 source tar ball

Extract to /home/pi

3. Build Percona XtraBackup

This will take about 3 hours.

Note: installing the package libcurl4-gnutls-dev  will remove the package libcurl4-openssl-dev . I had compile failures for XtraBackup when libcurl4-openssl-dev  was installed.

Download XtraBackup 2.4.14

Extract to /home/pi

4. Build Percona Toolkit

Done in a few minutes.

extract to /home/pi

5. Create the mysqsl user

Create directories for mysql to use.

Change ownership of directories to mysql user.

6. Prep my.cnf

I like to remove any leftover mysql directories or files in /etc before I create my file in the next step.

Add these lines, below, to your new my.cnf file.

Save the my.cnf file.

7. Initialize the database files

At this point, you can initialize the database files

8. Start Percona Server

This is the exciting part coming up. We are going to start Percona Server

If everything went well you should see the following lines in your /var/log/mysql/mysqld.log .

9. Test login to Percona Server

If you plan on keeping this as an active Percona Server I strongly advise you to remove the root user and create your own privileged user.

First, stop Percona Server

Create the mysqld.server and enable it.

Now if everything was done correctly you should be able to reboot your Pi and Percona Server will auto start on OS Boot.

This is it, you now have an entire Percona Server for MySQL up and running, with XtraBackup for your daily backups and Percona Toolkit to assist you with daily and complicated tasks. If you try this out, I’d love to hear about the uses you make of your Percona Server on a Raspberry Pi.


Image based on Photo by Hector Bermudez on Unsplash

The content in this blog is provided in good faith by members of the open source community. The content is not edited or tested by Percona, and views expressed are the authors’ own. When using the advice from this or any other online resource test ideas before applying them to your production systems, and always secure a working back up.

Wayne Leutwyler

Principal Data Engineer at UnitedHealth Group for the last 24 years. When he is not working or playing with MySQL. Wayne likes to do woodworking, listening to all forms of Metal music and electronic projects with Raspberry PI, Arduino. Wayne lives in Columbus Ohio, with his wife and daughter.

Leave a Reply