Welcome to our guide on how to install Percona Server for MySQL 8.0 on RHEL / CentOS 8 Linux server. Percona Server for MySQL is a free, open source and fully compatible replacement for MySQL that offers breakthrough performance and scalability. The software is created by Percona as a drop in replacement for Oracle MySQL relational database management system. The Percona Server software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server.
In this blog post, we will do the installation of Percona Server for MySQL 8.0 on CentOS 8 / RHEL 8 server. You can either do the installation from RPM packages or from Official Percona repositories. I prefer the latter because of the seamless upgrade process.
Follow the steps provided in the next sections to install Percona Server for MySQL 8.0 on CentOS 8 / RHEL 8. We will cover installation, hardening, and basic database operations such as creation of database, user and privilege assignment.
Step 1: Update RHEL / CentOS 8 server
We always ensure our server is updated. This is majorly true for new installations of CentOS / RHEL 8 system.
sudo yum -y update
Step 2: Add Percona YUM repository
Ready-to-use packages are available from the Percona Server for MySQL software repositories. The Percona yum repository supports popular RPM-based operating systems, including the CentOS, RHEL, Fedora and Amazon Linux AMI.
Install Percona repository by running the command below with sudo.
sudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
Press y when prompted to complete the transaction.
....
Dependencies resolved.
======================================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================================
Installing:
percona-release noarch 1.0-27 @commandline 20 k
Transaction Summary
======================================================================================================================================================================================================
Install 1 Package
Total size: 20 k
Installed size: 32 k
Is this ok [y/N]: y
Confirm installation of Percona repository on RHEL / CentOS 8.
$ rpm -qi percona-release
Name : percona-release
Version : 1.0
Release : 27
Architecture: noarch
Install Date: Thu 17 Aug 2023 08:06:39 PM UTC
Group : System Environment/Base
Size : 33154
License : GPL-3.0+
Signature : DSA/SHA1, Tue 17 Aug 2021 02:59:47 PM UTC, Key ID 1c4cbdcdcd2efd2a
Source RPM : percona-release-1.0-27.src.rpm
Build Date : Mon 16 Aug 2021 04:45:48 PM UTC
Build Host : minimal-centos-6-x32-773
Relocations : (not relocatable)
...
Step 3: Enable repository for MySQL 8.0
The installation created a new repository file in /etc/yum.repos.d/percona-original-release.repo. We need to enable Percona Server 8.0 repository using the next command.
sudo percona-release setup ps80
You’re prompted to disable RHEL 8 module for MySQL, this can be achieved manually by running:
sudo dnf module disable mysql -y
Step 4: Install Percona Server for MySQL 8.0
The Percona Server is intended for mission-critical, heavy-load production systems. Install Percona Server 8.0 on your CentOS 8 / RHEL 8 server:
sudo yum install percona-server-server percona-toolkit -y
sudo percona-release enable-only tools release
sudo yum install percona-xtrabackup-80
More info on server package:
$ rpm -qi percona-server-server
Name : percona-server-server
Version : 8.0.33
Release : 25.1.el8
Architecture: x86_64
Install Date: Thu 17 Aug 2023 08:08:55 PM UTC
Group : Applications/Databases
Size : 471045739
License : Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field..
Signature : RSA/SHA256, Wed 07 Jun 2023 10:00:54 PM UTC, Key ID 9334a25f8507efa5
Source RPM : percona-server-8.0.33-25.1.el8.src.rpm
Build Date : Wed 07 Jun 2023 02:54:25 PM UTC
Build Host : ip-10-199-2-187.eu-west-1.compute.internal
....
Step 5: Start and Secure Percona MySQL Server
Now that Percona Server 8.0 is installed, start and set the mysqld service to start at system boot.
sudo systemctl enable --now mysqld
Check service status.
$ systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2023-08-17 20:10:29 UTC; 13s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 8568 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 8647 (mysqld)
Status: "SERVER_OPERATING"
Tasks: 39 (limit: 23876)
Memory: 571.9M
CGroup: /system.slice/mysqld.service
└─8647 /usr/sbin/mysqld
ug 17 20:10:23 rocky8.mylab.io systemd[1]: Starting MySQL Server...
Aug 17 20:10:29 rocky8.mylab.io systemd[1]: Started MySQL Server.
Copy generated root password for initial access.
$ sudo grep "temporary password" /var/log/mysqld.log
2019-09-07T12:05:37.130661Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Gr8sAuo<O!5U
Run mysql_secure_installation script to harden your Database server.
$ sudo mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root: <Paste-copied-password>
The existing password for the user account root has expired. Please set a new password.
New password: <Enter-new-password>
Re-enter new password: <Retype-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) :
… 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
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
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
Success.
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
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Dropping test database…
Success.
Removing privileges on test database…
Success.
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
Success.
All done!
Try access database CLI as root user with the newly set password.
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.33-25
Copyright (c) 2009-2023 Percona LLC and/or its affiliates
Copyright (c) 2000-2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Show MySQL server version.
mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.0.33-25 |
+-----------+
1 row in set (0.00 sec)
Create test database and user.
mysql> CREATE DATABASE testdb;
Query OK, 1 row affected (0.02 sec)
mysql> CREATE USER testuser@localhost IDENTIFIED BY 'crHsAu56o<O!5Ux';
Query OK, 0 rows affected (0.02 sec)
mysql> GRANT ALL ON testdb.* TO testuser@localhost;
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> QUIT
Bye
Check if testuser can access database.
$ mysql -u testuser -p'crHsAu56o<O!5Ux'
...
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| testdb |
+--------------------+
2 rows in set (0.00 sec)
mysql> QUIT
Bye
Drop test database and user.
$ mysql -u root -p
mysql> DROP DATABASE testdb;
Query OK, 0 rows affected (0.02 sec)
mysql> DROP USER testuser@localhost;
Query OK, 0 rows affected (0.02 sec)
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> QUIT
Bye
Recommended MySQL Books:
Other MySQL related articles.