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 : 12 Architecture: noarch Install Date: Sat 07 Sep 2019 07:52:57 AM EDT Group : System Environment/Base Size : 19912 License : GPL-3.0+ Signature : DSA/SHA1, Thu 15 Aug 2019 09:38:36 AM EDT, Key ID 1c4cbdcdcd2efd2a Source RPM : percona-release-1.0-12.src.rpm Build Date : Thu 15 Aug 2019 01:38:34 PM EDT Build Host : minimal-centos-6-x32-19637 Relocations : (not relocatable) Summary : Package to install Percona GPG key and YUM repo Description : percona-release package contains Percona GPG public keys and Percona repository configuration for YUM
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 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.16 Release : 7.1.el8 Architecture: x86_64 Install Date: Sat 07 Sep 2019 08:01:44 AM EDT Group : Applications/Databases Size : 404495862 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, Wed 14 Aug 2019 12:08:05 PM EDT, Key ID 9334a25f8507efa5 Source RPM : percona-server-8.0.16-7.1.el8.src.rpm Build Date : Wed 14 Aug 2019 12:01:40 PM EDT Build Host : minimal-rhel-8-x64-19531.ci.percona.com Relocations : (not relocatable) Packager : Percona MySQL Development Team <[email protected]> Vendor : Percona, Inc URL : http://www.percona.com/ Summary : Percona Server: a very fast and reliable SQL database server
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 Sat 2019-09-07 08:05:41 EDT; 23s 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 Sep 07 08:05:31 rhel8.novalocal systemd: Starting MySQL Server... Sep 07 08:05:41 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.
$ 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.16-7 Percona Server (GPL), Release 7, Revision 613e312 Copyright (c) 2009-2019 Percona LLC and/or its affiliates Copyright (c) 2000, 2019, 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 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.16-7 | +-----------+ 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.16-7 Percona Server (GPL), Release 7, Revision 613e312 Copyright (c) 2009-2019 Percona LLC and/or its affiliates Copyright (c) 2000, 2019, 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 owners. 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
Video Courses to Master MySQL Database Management:
- The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert
- SQL – MySQL for Data Analytics and Business Intelligence
- MySQL, SQL and Stored Procedures from Beginner to Advanced
- SQL for Beginners: Learn SQL using MySQL and Database Design
- The Complete MySQL Developer Course
- MySQL Database Administration: Beginner SQL Database Design
- Learn Database Design with MySQL
Other MySQL related articles.