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.
Updating Subscription Management repositories. Last metadata expiration check: 1:44:49 ago on Sat 07 Sep 2019 06:08:03 AM EDT. percona-release-latest.noarch.rpm 11 kB/s | 17 kB 00:01 Dependencies resolved. =================================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================================== Installing: percona-release noarch 1.0-12 @commandline 17 k Transaction Summary =================================================================================================================================================== Install 1 Package Total size: 17 k Installed size: 19 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 May 5 23:55:01 2022 Group : System Environment/Base Size : 33154 License : GPL-3.0+ Signature : DSA/SHA1, Tue Aug 17 17:59:47 2021, Key ID 1c4cbdcdcd2efd2a Source RPM : percona-release-1.0-27.src.rpm Build Date : Mon Aug 16 19:45:48 2021 Build Host : minimal-centos-6-x32-773 Relocations : (not relocatable) Summary : Package to install Percona GPG key and YUM repo ...
Step 3: Enable the 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
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.27 Release : 18.1.el8 Architecture: x86_64 Install Date: Thu May 5 23:57:17 2022 Group : Applications/Databases Size : 338521808 License : Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field.. Signature : RSA/SHA256, Tue Mar 1 17:35:54 2022, Key ID 9334a25f8507efa5 Source RPM : percona-server-8.0.27-18.1.el8.src.rpm Build Date : Tue Mar 1 17:11:05 2022 Build Host : ip-10-199-2-91.eu-west-1.compute.internal Relocations : (not relocatable) Packager : Percona MySQL Development Team <[email protected]> Vendor : Percona, Inc URL : http://www.percona.com/ ....
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 2022-05-05 23:58:26 EAT; 10s 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 May 05 23:58:21 rhel8.novalocal systemd: Starting MySQL Server... May 05 23:58:21 rhel8.novalocal systemd: 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 [email protected]: 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.27-18 Copyright (c) 2009-2021 Percona LLC and/or its affiliates Copyright (c) 2000, 2021, 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.27-18 | +-----------+ 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 [email protected] IDENTIFIED BY 'crHsAu56o<O!5Ux'; Query OK, 0 rows affected (0.02 sec) mysql> GRANT ALL ON testdb.* TO [email protected]; 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' mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.0.27-18 Copyright (c) 2009-2021 Percona LLC and/or its affiliates Copyright (c) 2000, 2021, Oracle and/or its affiliates. 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 [email protected]; 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