Sometimes we might need to install/upgrade Percona Server for MySQL/MySQL 8 to a particular version in a test or production environment. The reason might be application requirements, compatibility issues, or MySQL bug fixes, or we want the same MySQL version to be installed on all database instances in the cluster, regardless of what actually is the latest version available.
In this post, we’ll show you how to achieve this with the following options.
Let’s start and test on Debian 11.
1.1 Update the package repositories
|
1 |
<b>$ sudo apt update</b> |
1.2 Install the curl download utility
|
1 |
$ sudo apt install curl <br>Reading package lists... Done<br>…….<br>Unpacking curl (7.74.0-1.3+deb11u7) ...<br>Setting up curl (7.74.0-1.3+deb11u7) ...<br>Processing triggers for man-db (2.9.4-2) … |
1.3 Download the percona-release repository package, and install it
|
1 |
$ curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb <br>% Total % Received % Xferd Average Speed Time Time Time Current<br> Dload Upload Total Spent Left Speed<br>100 11804 100 11804 0 0 21619 0 --:--:-- --:--:-- --:--:-- 21619<br><br><br>$ sudo apt install gnupg2 lsb-release ./percona-release_latest.generic_all.deb <br> Reading package lists... Done<br>…..<br>The following NEW packages will be installed:<br>…<br>After this operation, 501 kB of additional disk space will be used.<br>Do you want to continue? [Y/n] y<br>Get:1 /root/percona-release_latest.generic_all.deb percona-release all 1.0-27.generic [.....<br>Setting up percona-release (1.0-27.generic) ...<br>* Enabling the Percona Original repository<br><*> All done!<br>==> Please run "apt-get update" to apply changes<br>* Enabling the Percona Release repository<br><*> All done!<br>==> Please run "apt-get update" to apply changes<br>The percona-release package now contains a percona-release script that can enable additional repositories for our newer products.<br>For example, to enable the Percona Server 8.0 repository use:<br> percona-release setup ps80<br>Note: To avoid conflicts with older product versions, the percona-release setup command may disable our original repository for some products.<br>For more information, please visit:<br> https://www.percona.com/doc/percona-repo-config/percona-release.html<br>Processing triggers for man-db (2.9.4-2) .. |
1.4 Refresh the local cache to update the package information
|
1 |
$ sudo apt update <br>Hit:1 http://security.debian.org/debian-security bullseye-security InRelease<br>Hit:2 http://deb.debian.org/debian bullseye InRelease |
1.5 Set up the repository for the Percona Server for MySQL 8.0
|
1 |
$ sudo percona-release setup ps80 <br>* Disabling all Percona Repositories<br>* Enabling the Percona Server 8.0 repository<br>* Enabling the Percona Tools repository<br>Hit:1 http://security.debian.org/debian-security bullseye-security InRelease<br>/etc/apt/sources.list:12 and /etc/apt/sources.list:18<br><br>$ sudo apt update<br>Hit:1 http://deb.debian.org/debian bullseye InRelease<br>….<br>Building dependency tree... Done |
1.6 Check the available Percona Server for MySQL 8.0 version
|
1 |
$ sudo apt list -a percona-server-server #<br>Listing... Done<br>percona-server-server/stable 8.0.32-24-1.bullseye amd64<br>percona-server-server/stable 8.0.31-23-1.bullseye amd64<br>percona-server-server/stable 8.0.30-22-1.bullseye amd64<br>percona-server-server/stable 8.0.29-21-1.bullseye amd64<br>percona-server-server/stable 8.0.28-20-1.bullseye amd64 |
1.7 Let’s install Percona Server for MySQL 8.0, specifically version 8.0.28
|
1 |
$sudo apt install percona-server-server=8.0.28-20-1.bullseye percona-server-common=8.0.28-20-1.bullseye percona-server-client=8.0.28-20-1.bullseye <br><br>Reading package lists... Done<br>The following NEW packages will be installed:<br> debsums libaio1 libfile-fnmatch-perl libmecab2 percona-server-client percona-server-common percona-server-server<br>0 upgraded, 7 newly installed, 0 to remove and 65 not upgraded.<br>Need to get 68.1 MB of archives.<br>After this operation, 491 MB of additional disk space will be used.<br>Do you want to continue? [Y/n] y<br>pdate-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode<br>Choose authentication method etc<br> * Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.<br> * Run the following commands to create these functions:<br><br>mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"<br>mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"<br>mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"<br> * See http://www.percona.com/doc/percona-server/8.0/management/udf_percona_toolkit.html for more details<br>Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.<br>Processing triggers for man-db (2.9.4-2) ...<br>Processing triggers for libc-bin (2.31-13+deb11u6) ... |
Here we go; we have installed Percona Server for MySQL 8.0 version 8.0.28.
|
1 |
$ mysql<br>Welcome to the MySQL monitor. Commands end with ; or g.<br>Your MySQL connection id is 8<br>Server version: 8.0.28-20 Percona Server (GPL), Release '20', Revision 'fd4b5a776a6'<br>Copyright (c) 2009-2022 Percona LLC and/or its affiliates<br>Copyright (c) 2000, 2022, Oracle and/or its affiliates.<br>Oracle is a registered trademark of Oracle Corporation and/or its<br>affiliates. Other names may be trademarks of their respective<br>owners.<br>Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.<br>mysql> <br>$ tail -100 /var/log/mysql/error.log<br>2023-06-05T23:31:46.511264Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.<br>2023-06-05T23:31:46.511283Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.28-20) initializing of server in progress as process 3909<br>…….<br>2023-06-05T23:35:04.393351Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock<br>2023-06-05T23:35:04.393685Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.28-20' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Percona Server (GPL), Release '20', Revision 'fd4b5a776a6'. |
1.8 If we need to upgrade Percona Server for MySQL 8.0 version from 8.0.28 to 8.0.30
We just need to stop MySQL and install it as below.
|
1 |
$ systemctl stop mysql <br>$ cp /etc/mysql/my.cnf . # backup the my.cnf <br>$sudo apt install percona-server-server=8.0.30-22-1.bullseye percona-server-common=8.0.30-22-1.bullseye percona-server-client=8.0.30-22-1.bullseye <br>$ sudo apt install percona-server-server=8.0.30-22-1.bullseye percona-server-common=8.0.30-22-1.bullseye percona-server-client=8.0.30-22-1.bullseye <br>Reading package lists... Done<br>Building dependency tree... Done<br>Reading state information... Done<br>The following packages will be upgraded:<br> percona-server-client percona-server-common percona-server-server<br>3 upgraded, 0 newly installed, 0 to remove and 65 not upgraded.<br>Need to get 133 MB of archives.<br>After this operation, 10.1 MB of additional disk space will be used.<br>Get:1 http://repo.percona.com/ps-80/apt bullseye/main amd64 percona-server-server amd64 8.0.30-22-1.bullseye [112 MB]<br>…….<br>(Reading database ... 137005 files and directories currently installed.)<br>Preparing to unpack .../percona-server-server_8.0.30-22-1.bullseye_amd64.deb ...<br>Unpacking percona-server-server (8.0.30-22-1.bullseye) over (8.0.28-20-1.bullseye) ...<br>Preparing to unpack .../percona-server-client_8.0.30-22-1.bullseye_amd64.deb ...<br>Unpacking percona-server-client (8.0.30-22-1.bullseye) over (8.0.28-20-1.bullseye) ...<br>Preparing to unpack .../percona-server-common_8.0.30-22-1.bullseye_amd64.deb ...<br>Unpacking percona-server-common (8.0.30-22-1.bullseye) over (8.0.28-20-1.bullseye) ...<br>Setting up percona-server-common (8.0.30-22-1.bullseye) ...<br>Setting up percona-server-client (8.0.30-22-1.bullseye) ...<br>Setting up percona-server-server (8.0.30-22-1.bullseye) ...<br>…….<br><br> * See http://www.percona.com/doc/percona-server/8.0/management/udf_percona_toolkit.html for more details<br>Processing triggers for man-db (2.9.4-2) ...<br>Processing triggers for libc-bin (2.31-13+deb11u6) ...<br>$tail -20 /var/log/mysql/error.log<br>2023-06-05T23:34:27.813809Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-20) starting as process 4103<br>2023-06-05T23:34:27.907429Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.<br>….<br>2023-06-06T00:01:09.725417Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-22) starting as process 4657<br>2023-06-06T00:01:09.751320Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.<br>2023-06-06T00:01:43.835245Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.<br>2023-06-06T00:01:53.233780Z 4 [System] [MY-013381] [Server] Server upgrade from '80028' to '80030' started.<br>2023-06-06T00:02:10.305075Z 4 [System] [MY-013381] [Server] Server upgrade from '80028' to '80030' completed.<br>2023-06-06T00:02:19.030342Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.<br>2023-06-06T00:02:19.030374Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.<br>2023-06-06T00:02:19.076960Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock<br>2023-06-06T00:02:19.080729Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.30-22' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Percona Server (GPL), Release '22', Revision '7e301439b65'.<br> |
From the error log, we could see MySQL Server has been upgraded from 8.0.28 to 8.0.30.
Next, let’s install the Percona Server for MySQL 8 specific version with the tarball.
2.1 Install Percona Server for MySQL 8.0.31 with tarball packages
|
1 |
$sudo apt-get install libaio1<br>$ls -al <br>percona-server-client_8.0.31-23-1.buster_amd64.deb<br>percona-server-common_8.0.31-23-1.buster_amd64.deb<br>percona-server-server_8.0.31-23-1.buster_amd64.deb<br>$sudo dpkg -i *deb<br>$ tail -100 /var/log/mysql/error.log<br>2023-06-07T05:41:22.968218Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.<br>2023-06-07T05:41:22.968297Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-23) starting as process 15337<br>2023-06-07T05:41:22.986337Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.<br>2023-06-07T05:49:49.026256Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.<br>2023-06-07T05:54:19.344027Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-23' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Percona Server (GPL), Release '23', Revision '71449379'.<br> |
2.2 Upgrade Percona Server for MySQL 8.0.31 to 8.0.32 with tarball packages
|
1 |
$ ls <br>percona-server-client_8.0.32-24-1.bullseye_amd64.deb<br>percona-server-common_8.0.32-24-1.bullseye_amd64.deb<br>percona-server-server_8.0.32-24-1.bullseye_amd64.deb<br><br>$dpkg -i *.deb<br>(Reading database ... 137007 files and directories currently installed.)<br>Preparing to unpack percona-server-client_8.0.32-24-1.bullseye_amd64.deb ...<br>Unpacking percona-server-client (8.0.32-24-1.bullseye) over (8.0.31-23-1.buster) ...<br>Preparing to unpack percona-server-common_8.0.32-24-1.bullseye_amd64.deb ...<br>Unpacking percona-server-common (8.0.32-24-1.bullseye) over (8.0.31-23-1.buster) ...<br>Preparing to unpack percona-server-server_8.0.32-24-1.bullseye_amd64.deb ...<br>Unpacking percona-server-server (8.0.32-24-1.bullseye) over (8.0.31-23-1.buster) ...<br>Setting up percona-server-common (8.0.32-24-1.bullseye) ...<br>Setting up percona-server-client (8.0.32-24-1.bullseye) ...<br>Setting up percona-server-server (8.0.32-24-1.bullseye) ...<br><br>mysql><br>Welcome to the MySQL monitor. Commands end with ; or g.<br>Your MySQL connection id is 10<br>Server version: 8.0.32-24 Percona Server (GPL), Release '24', Revision 'e5c6e9d2'<br>mysql> s<br>--------------<br>mysql Ver 8.0.32-24 for Linux on x86_64 (Percona Server (GPL), Release '24', Revision 'e5c6e9d2')<br><br>tail -100 /var/log/mysql/error.log<br>2023-06-07T23:07:42.007827Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.<br>2023-06-07T23:12:04.925749Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.<br>2023-06-07T23:12:29.929705Z 4 [System] [MY-013381] [Server] Server upgrade from '80031' to '80032' started.<br>2023-06-07T23:12:42.281359Z 4 [System] [MY-013381] [Server] Server upgrade from '80031' to '80032' completed.<br>2023-06-07T23:12:43.321008Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.<br>2023-06-07T23:12:43.321079Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.<br>2023-06-07T23:12:43.336283Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock<br>2023-06-07T23:12:43.336416Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.32-24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Percona Server (GPL), Release '24', Revision 'e5c6e9d2'.<br><br> |
Take away one:
For the MySQL community version, it seems the latest version, 8.0.33, is available; no other 8.0.x version is when we try to install via the repository.
|
1 |
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.25-1_all.deb<br>$sudo dpkg -i mysql-apt-config_0.8.25-1_all.deb<br>$sudo apt-get update<br>$sudo apt list -a mysql-server<br>Listing... Done<br>mysql-server/unknown 8.0.33-1debian11 amd64<br>$sudo apt-get install mysql-server |
We could install/upgrade to MySQL 8 specific version with deb packages as below.
|
1 |
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_8.0.27-1debian11_amd64.deb-bundle.tar<br>$tar -xvf mysql-server_8.0.27-1debian11_amd64.deb-bundle.tar<br>$dpkg -i libmysqlclient21_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-common_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-community-client-plugins_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-community-client-core_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-community-client_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-client_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-community-server-core_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-community-server-core_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-community-server_8.0.27-1debian11_amd64.deb<br>$dpkg -i mysql-server_8.0.27-1debian11_amd64.deb |
Take away two:
You might need to hold the MySQL 8 specific version packages to prevent apt-get upgrade and Update Manager and upgrade it to another version.
|
1 |
#hold the percona mysql version<br>sudo apt-mark hold percona-server-client<br>sudo apt-mark hold percona-server-common<br>sudo apt-mark hold percona-server-server<br><br>#show hold<br>sudo apt-mark showhold<br>percona-server-client<br>percona-server-common<br>percona-server-server<br><br>#unhold the percona mysql version, then we could upgrade to another version<br>sudo apt-mark unhold percona-server-client<br>sudo apt-mark unhold percona-server-common<br>sudo apt-mark unhold percona-server-server<br><br>#For percona mysql , you could also replace step 1.5<br>$sudo percona-release setup ps80 <br>with<br>$sudo percona-release setup pdps-8.0.28<br>This will set up the repo to a specific version, and you will never get a new version if you will not enable another repo.<br><br><br>-== below is for MySQL community <br>#show hold<br>$apt-mark showhold <br>libdbd-mysql-perl<br>libmariadb3<br>mariadb-common<br>mysql-client<br>mysql-common<br>mysql-community-client<br>mysql-community-client-core<br>mysql-community-client-plugins<br>mysql-community-server<br>mysql-community-server-core<br>mysql-server<br><br># hold the packages <br>sudo apt-mark hold libdbd-mysql-perl<br>sudo apt-mark hold libmariadb3<br>sudo apt-mark hold mariadb-common<br>sudo apt-mark hold mysql-client<br>sudo apt-mark hold mysql-common<br>sudo apt-mark hold mysql-community-client<br>sudo apt-mark hold mysql-community-client-core<br>sudo apt-mark hold mysql-community-client-plugins<br>sudo apt-mark hold mysql-community-server<br>sudo apt-mark hold mysql-community-server-core<br>sudo apt-mark hold mysql-server<br>sudo apt-mark hold libmysqlclient-dev<br>sudo apt-mark hold libmysqlclient21<br><br># unhold the packages <br>sudo apt-mark unhold libdbd-mysql-perl<br>sudo apt-mark unhold libmariadb3<br>sudo apt-mark unhold mariadb-common<br>sudo apt-mark unhold mysql-client<br>sudo apt-mark unhold mysql-common<br>sudo apt-mark unhold mysql-community-client<br>sudo apt-mark unhold mysql-community-client-core<br>sudo apt-mark unhold mysql-community-client-plugins<br>sudo apt-mark unhold mysql-community-server<br>sudo apt-mark unhold mysql-community-server-core<br>sudo apt-mark unhold mysql-server<br>sudo apt-mark unhold libmysqlclient-dev<br>sudo apt-mark unhold libmysqlclient21 |
We could use the above method to install/upgrade Percona Server for MySQL 8 to a specific version and hold/un-hold the packages for management. Be sure to back up your database and my.cnf before you do that.
Hope this is helpful for you when you start to work on MySQL 8.
Percona Distribution for MySQL is the most complete, stable, scalable, and secure open source MySQL solution available, delivering enterprise-grade database environments for your most critical business applications… and it’s free to use!