How to Compile Percona Server for MySQL 5.7 in Raspberry Pi 3

Percona Server for MySQL on a Raspberry PiIn this post I’ll give to you the steps to compile Percona Server for MySQL 5.7.22 in Raspberry Pi 3. Why? Well because in general this little computer is cheap, has low power consumption, and is great to use as a test machine for developers.

By default Raspbian OS includes very few versions of MySQL to install

If you want to install MySQL or MariaDB on an ARM architecture using official pre-built binaries, you are limited to those distributions and versions.

Roel Van de Paar wrote time ago this post “Percona Server on the Raspberry Pi: Your own MySQL Database Server for Under $80” using “Fedora ARM” like OS on the first versions of raspberry cards.

Now we will use the last version of Raspberry Pi 3 with Raspbian OS. In my case, the OS version is this

The Installation of Percona Server for MySQL on Raspberry Pi 3

Let’s start. We will need many devs packages and cmake to compile the source code. There is the command line to update or install all these packages:

Now we need to download the Percona Server for MySQL 5.7.22 source code and then we can proceed to compile.

Before starting to compile the source code, we will need to extend the swap memory. This is necessary to avoid encountering memory problems at compilation time.

Now we can check the memory and find that memory swap is correct

This is the output in my case

I recommend to use a screen session to compile the source code, because it takes a lot of time.

After it has compiled and installed successfully, it’s time to create our datadir directory for this Percona Server version, and the mysql user. Feel free to use other directory names

Now it’s time to create a minimal my.cnf config file to start mysql, you can use the below example

then we need to initialize the initial databases/schemas, ibdata and ib_logfile files with the next command

now—finally—it’s time start MySQL

We can check if MySQL started or not, by taking a look at the mysqld.log file

In our example it started ok.

Remember MySQL server was installed and started using an alternative path.
Now it’s time to connect and check if everything is running well.

To check the version that’s running, you can use the next command

Improving Performance

Keep in mind that you have configured the datadir directory in the same microSD where are you running the OS:  MySQL will run slowly. If you create a new table perhaps it will take a few seconds. So, I recommend that you use a separate USB SSD disk, and move the datadir directory to this SSD disk. That’s more useful and the performance is much better

I hope you enjoyed this guide on how to use a tiny server to install Percona Server for MySQL.
If you want to test other versions, please go ahead: the steps will be very similar to these.

Other related post about Raspberry PI

You May Also Like

Your application or website depend on your database to deliver information about your products and services to your customers. A high traffic event, such as Cyber Monday, can stress the availability of your database. Statistics show that 40% of users abandon a website if it takes longer than three seconds to load. Our preparatory checklist can help your business avoid and mitigate the effects of high traffic events and help keep business running as usual.

In his blog, Percona CEO Peter Zaitsev examines the four ways MySQL executes GROUP BY, a clause that could be responsible for 90% or more of your query’s execution time. Peter also discusses what to do when MySQL GROUP BY does not make the right choice when it comes to resolving the WHERE clause.

Share this post

Comment (1)

  • Roel Van de Paar

    Thank you Walter! A fast SD card may also help to improve performance!

    August 23, 2018 at 2:31 am

Comments are closed.

Use Percona's Technical Forum to ask any follow-up questions on this blog topic.