Install Percona Server for MySQL 8.0 on Ubuntu 22.04

Install Percona Server for MySQL 8.0 on Ubuntu 22.04

Percona Server for MySQL is a relational database that allows to access data using Structured Query Language (SQL). It is a fork of MySQL Server. Percona Server for MySQL is a fully compatible drop-in replacement for MySQL. All the functionality of MySQL are available in the Percona Server for MySQL. It also provides enhanced features for performance.

This tutorial shows how to install Percona Server for MySQL 8.0 on Ubuntu 22.04.

Install Percona Server for MySQL

Download Debian package (.deb) that adds and configures the Percona repository:

wget -qO percona_all.deb "https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb"

Install the downloaded package:

sudo dpkg -i percona_all.deb

The .deb package is no longer needed, you can remove it:

rm -rf percona_all.deb

Enable the repository:

sudo percona-release setup ps80

When it finished, install Percona Server for MySQL 8.0:

sudo DEBIAN_FRONTEND=noninteractive apt install -y percona-server-server

When installation is finished, we can check version:

mysql --version

The following command allows checking whether Percona Server for MySQL service is running:

sudo service mysql status

We can also stop, start and restart the service:

sudo service mysql stop
sudo service mysql start
sudo service mysql restart

We used non-interactive installation, so the password for the root user is blank, and we can connect to the server without any authentication:

sudo mysql -u root

Run the following SQL statement to change password of root user:

ALTER USER root@localhost IDENTIFIED WITH caching_sha2_password BY 'pwd123';

Exit interactive mode by executing exit a command inside the client:

exit

Try to connect again to server using password:

mysql -u root -p

Uninstall Percona Server for MySQL

Run the following command if you wish to completely remove any package with a name that starts with percona and anything related to it:

sudo DEBIAN_FRONTEND=noninteractive apt purge --autoremove -y percona-*

Remove Percona repositories:

sudo rm -rf /etc/apt/sources.list.d/percona*

Remove MySQL user:

sudo deluser mysql

You can also remove MySQL configuration, log files, and data:

sudo rm -rf /etc/mysql
sudo rm -rf /var/log/mysql
sudo rm -rf /var/lib/mysql*

Leave a Comment

Cancel reply

Your email address will not be published.