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:
  • 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

When I'm not working with MySQL or other Open-source software packages. I like to do woodworking, 3D design and Printing, listening to all forms of Metal music and electronic projects with Raspberry PI, Arduino. Wayne lives in Powell Ohio, with his wife, daughter, 6 cats and 2 dogs.


  • Hi there, you can get the full logs from my website:

    I created a POST on the forums:

  • I notice in your logs you are running as root to do all the compiling. I don’t recommend in doing it that way. My BLOG post is based on running as pi and using sudo when you need to run something as root. Did you create the swap file and activate it? You said it compiled just fine on the Pi4, which Pi4 1GB, 2GB or 4GB model?

    This error is in your log:

    c++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See for instructions. sql/CMakeFiles/sql.dir/build.make:949: recipe for target ‘sql/CMakeFiles/sql.dir/’ failed make[2]: *** [sql/CMakeFiles/sql.dir/] Error 4 The compile failed about 75% into it. I hit this in my testing when I ran out of memory on my Pi3+, I went back put the swap file in and it ran fine the next time.

  • Just a quick update. I followed these same docs on a Pi3+ and Pi4 4GB and percona server 5.7.27 complied with no issues. Please note tat on a Pi3+ you must create the swap file.

  • Just a quick update when installing 5.7.28-31 make sure you have sudo apt-get install libssl-dev installed. I tested last evening on a 3B+ and a 4 4GB. Both running Raspbian Buster. Both compiled and installed just fine.

  • I ended up running into a slight issues last night when I was doing the install a second time on a Raspberry Pi 3B+. I was finding the CPU getting over loaded and then freeze up the 3B+. I ended up downloading and installing cpulimit. sudo apt-get install cpulimit. Once install you can use cpulimit to keep make from using to much cpu. I found that running cpulimit -e make -l 80, then running make -j2, I was able to finish the build and install.

Leave a Reply