In this tutorial, we'll learn how to install Percona Server for MySQL AlmaLinux 9. An optimized MySQL fork with better performance and scalability.
Introduction
Percona Server for MySQL is an enhanced and drop-in replacement for MySQL. Percona has focused on optimizing MySQL’s performance and scalability, making it a robust choice for high-traffic environments. In addition, it includes advanced troubleshooting, monitoring, and performance instrumentation features.
Because Percona Server for MySQL is fully compatible with MySQL, migrating or switching between them is relatively straightforward. Below, you’ll learn how to install Percona Server for MySQL on AlmaLinux 9 step by step. By the end, you’ll have a working installation that you can begin using for your databases.
Prerequisites
- A AlmaLinux 9 installed dedicated server or KVM VPS.
- A root user or normal user with administrative privileges.
Install Percona Server for MySQL AlmaLinux
Step 1: Update Your Server’s Packages
Open Terminal or Connect via SSH: Log in to your AlmaLinux 9 server. If you’re using a remote server, connect through SSH.
Update the system packages:
sudo dnf update -y
-y automatically answers “yes” to any prompts.
This command makes sure all your existing packages are up to date and reduces conflicts when installing new software.
Step 2: Add the Percona Repository for AlmaLinux 9
Percona provides a repository RPM specifically for RHEL and its derivatives (like AlmaLinux, CentOS, and Rocky Linux). Installing this repository allows your system to access the Percona Server for MySQL packages.
Download and install the Percona repository RPM:
sudo dnf install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
This single command downloads the Percona repository package directly and installs it on your AlmaLinux 9 system. Once installed, the Percona repositories will be available to your package manager (dnf).
Enable the Percona Server 8.4 LTS repository (if necessary):
By default, installing percona-release-latest.noarch.rpm often enables the main Percona 8.4 LTS repository. If for some reason it’s not enabled, you can manually enable it:
sudo percona-release setup ps84lts
ps84lts
means “Percona Server 8.4 LTS.” This ensures that dnf will install the latest stable Percona Server for MySQL 8.0.
Verify the repository (optional):
dnf repolist | grep -i percona
This checks the list of repositories for entries related to Percona.
Step 3: Install Percona Server for MySQL
With the repository in place, you can now install Percona Server for MySQL just like you would any other package.
Install the server:
sudo dnf install -y percona-server-server
dnf will fetch the Percona packages from the newly added repository.
If prompted to confirm, type y or just rely on the -y flag you already used.
Start and enable the MySQL service:
sudo systemctl enable mysqld
sudo systemctl start mysqld
Check service status:
systemctl status mysqld
Look for an active (running) status in the output. If you see that, your Percona Server for MySQL is now running.
Look for “temporary password
” in the log. You can do something like:
sudo grep 'temporary password' /var/log/mysqld.log
Output should look like:
2025-03-04T02:31:03.750674Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: FfZfwBJlQ6<u
Step 4: Secure Your Percona Server Installation
Percona Server for MySQL includes a script called mysql_secure_installation (just like standard MySQL) that helps you tighten security.
Run the secure installation script:
sudo mysql_secure_installation
Step 5: Verify the Installation
Log in to MySQL:
mysql -u root -p
Type in the password you created during mysql_secure_installation.
If successful, you’ll see a prompt that looks like mysql.
Check existing databases:
SHOW DATABASES;
You’ll see several default system databases such as information_schema, performance_schema, and so on.
Create a test database (optional but useful for verification):
CREATE DATABASE test_db;
If this command completes without error, your Percona Server is fully functional.
Type exit; or \q to leave the MySQL shell.
Step 6: Basic Configuration Tweaks (Optional)
AlmaLinux 9 typically places MySQL configuration files in /etc/my.cnf or /etc/my.cnf.d/ or in the /etc/percona-server.conf.d/ directory. Adjusting these files can improve performance and tailor the server to your environment.
Identify configuration files:
Usually, /etc/my.cnf
is the main file. It may include other configuration files located in /etc/my.cnf.d/.
For Percona Server 8.0, also check /etc/percona-server.conf.d/.
Common settings:
bind-address
: Determines which IP address MySQL listens on. If you want to allow remote connections, ensure this is set to your server’s IP and that your firewall and security settings allow external traffic.max_connections
: Controls the maximum number of simultaneous connections. Increase if you anticipate high concurrency.innodb_buffer_pool_size
: Often one of the most important settings for performance. It should be sized based on your server’s RAM and workload.
Restart MySQL to apply changes:
sudo systemctl restart mysqld
Any changes in the config files require a restart for them to take effect.
Step 7: Keep Your Server Updated
Regular updates:
sudo dnf update -y
This updates the package lists and upgrades any available packages, including those from the Percona repository.
Check logs for any issues:
Look at /var/log/mysqld.log
or /var/log/mysql/
directory if you run into performance issues or error messages. Percona’s advanced diagnostic features can help you pinpoint problems.
Leverage Percona Toolkit (Optional advanced step):
Percona Toolkit is a suite of command-line tools that help optimize and manage MySQL databases (e.g., pt-query-digest, pt-online-schema-change). You can install these tools to better handle performance analytics and advanced schema changes.
Conclusion
By following these instructions, you’ve successfully installed Percona Server for MySQL on AlmaLinux 9. Here’s what you achieved:
- Updated your AlmaLinux server for smooth installation.
- Added the Percona repository and installed Percona Server for MySQL.
- Secured the server with mysql_secure_installation.
- Verified the installation and created a test database.
- Learned how to configure and optimize Percona Server for your specific needs.
Going forward, you can further explore the advanced replication and performance-tuning features offered by Percona. It’s a powerful solution for mission-critical applications that demand reliable, high-performance database services. Enjoy your new Percona Server for MySQL installation on AlmaLinux 9!