CentLinux | Learn How to Install CentOS/Rocky Linux Servers

Saturday, November 21, 2020

Install Percona Server for MySQL on CentOS/RHEL 8

Install Percona Server for MySQL on CentOS 8

Percona Server is a distribution of MySQL RDBMS. In this article, you will see how to install this database server on CentOS / RHEL 8.


Table of Contents:


What is Percona Server for MySQL? :

Percona Server for MySQL is an open source relational database management system (RDBMS) created by Percona. It is a free, fully compatible drop in replacement for Oracle MySQL. The software includes a number of scalability, availability, security and backup features only available in MySQL's commercial Enterprise edition. The software includes XtraDB, an enhanced distribution of the InnoDB Storage Engine.

The developers aim to retain close compatibility to the official MySQL releases, while focusing on performance and increased visibility into server operations.

This open source software is distibuted under GNU General Public License (version 2). (Source: Wikipedia)

Install Percona Server for MySQL on CentOS 8

Features in Percona Server for MySQL:

Percona database server has following features.

  • Faster and more consistently run queries
  • Enhanced security with binary log (binlog) encryption and data-at-rest encryption
  • Improved efficiency with server consolidation
  • Delayed or completely avoided sharding
  • Better ROI through lower hosting fees and power usage
  • Cloud-ready support


Environment Specification:

We are using a minimal CentOS 8 KVM with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - CentOS 8.2
  • Hostname - percona-01.centlinux.com
  • IP Address - /24


Updating Linux Operating System:

Connect with percona-01.centlinux.com as root user by using a ssh client.

It is a good practice to update Linux software packages before installing a new software. We recommend you to upgrade centos 7 to centos 8, if you have not already did so.

# dnf update -y
Last metadata expiration check: 0:01:56 ago on Fri 20 Nov 2020 08:22:31 PM PKT.
Dependencies resolved.
Nothing to do.

Software packages in our Linux operating system are already up-to-date.

Verify the operating system and Linux Kernel version that are being used in this installation guide.

# uname -r

# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)


Installing Percona Yum Repository:

There are different ways to install Percona Server for MySQL. You can install it by using RPMs, Source Code or Official Yum Repository.

Since, you are working on Red Hat based Linux distro, therefore, the most convenient method is to install it from their official yum repository.

Therefore, you need to install Percona yum repository in your Linux server.

# dnf install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm


Percona yum repository also installs percona-release script. This script is used to enable/disable additional yum repositories.

Execute the following command to enable Percona server 8.0 repository and disable all other MySQL yum repositories.

# percona-release setup ps80


Build cache for newly installed yum repositories.

# dnf makecache
CentOS-8 - AppStream                            3.6 kB/s | 4.3 kB     00:01
CentOS-8 - Base                                 3.5 kB/s | 3.9 kB     00:01
CentOS-8 - Extras                               1.2 kB/s | 1.5 kB     00:01
Percona Release release/noarch YUM repository   4.3 kB/s | 2.9 kB     00:00
Percona Server 8.0 release/x86_64 YUM repositor 4.4 kB/s | 2.9 kB     00:00
Percona Tools release/x86_64 YUM repository     4.1 kB/s | 2.9 kB     00:00
Metadata cache created.


Installing Percona Server for MySQL on CentOS / RHEL 8:

You can now install Percona RDBMS by using dnf command.

# dnf install -y percona-server-server


Enable and start mysqld.service.

# systemctl enable --now mysqld.service
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service â /usr/lib/systemd/system/mysqld.service.

Verify the version of your database server.

# mysql -V
mysql  Ver 8.0.21-12 for Linux on x86_64 (Percona Server (GPL), Release 12, Revision 7ddfdfe)

On first startup, the mysqld.service generates a random password for root user.

You can obtain auto generated root password from mysqld.service logs by executing following command.

# grep "temporary password" /var/log/mysqld.log
2020-11-20T15:48:32.560387Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: cjk-4sB/bWWt

Secure your database machine by executing mysql_secure_installation command and configure the security options as follows.

# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:

Re-enter new password:
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.

Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : N

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
 - Dropping test database...

 - Removing privileges on test database...

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

All done!

Percona Server for MySQL has been installed and configured on your Linux machine.

Login to MySQL shell as root user.

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 8.0.21-12 Percona Server (GPL), Release 12, Revision 7ddfdfe

Copyright (c) 2009-2020 Percona LLC and/or its affiliates
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


List down the available databases in your server.

mysql> show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
4 rows in set (0.01 sec)

Check the version of your database server.

mysql> select version();
| version() |
| 8.0.21-12 |
1 row in set (0.00 sec)

Exit from MySQL shell.

mysql> exit



In this article, you have learned, how to install Percona Server for MySQL on CentOS / RHEL  8. A recommended book on MySQL RDBMS is Murach's MySQL (3rd Edition) by Joel Murach.

If you find this article useful? Consider supporting us by Buy Me A Coffee

No comments:

Post a Comment

© 2023 CentLinux. All Rights Reserved.