9

How to Install or Upgrade Percona Server for MySQL/MySQL 8 to a Specific Version...

 1 year ago
source link: https://www.percona.com/blog/how-to-install-or-upgrade-percona-server-for-mysql-mysql-8-to-a-specific-version-on-debian-ubuntu/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to Install or Upgrade Percona Server for MySQL/MySQL 8 to a Specific Version on Debian/Ubuntu

June 15, 2023

Larry Xia

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.

  • Install Percona Server for MySQL 8 specific version packages via repository.
  • Download specific Percona Server for MySQL 8 tarball packages and install them manually.

Let’s start and test on Debian 11.

1. Install Percona Server for MySQL 8 specific version on Debian 11 via repository

1.1 Update the package repositories

<b>$  sudo apt update</b>

1.2  Install the curl download utility

$  sudo apt install curl 
Reading package lists... Done
Unpacking curl (7.74.0-1.3+deb11u7) ...
Setting up curl (7.74.0-1.3+deb11u7) ...
Processing triggers for man-db (2.9.4-2) …

1.3 Download the percona-release repository package, and install it

$   curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb                    
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
   Dload  Upload   Total   Spent    Left  Speed
100 11804  100 11804    0     0  21619      0 --:--:-- --:--:-- --:--:-- 21619
$ sudo apt install gnupg2 lsb-release    ./percona-release_latest.generic_all.deb          
 Reading package lists... Done
The following NEW packages will be installed:
After this operation, 501 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 /root/percona-release_latest.generic_all.deb percona-release all 1.0-27.generic [.....
Setting up percona-release (1.0-27.generic) ...
* Enabling the Percona Original repository
<*> All done!
==> Please run "apt-get update" to apply changes
* Enabling the Percona Release repository
<*> All done!
==> Please run "apt-get update" to apply changes
The percona-release package now contains a percona-release script that can enable additional repositories for our newer products.
For example, to enable the Percona Server 8.0 repository use:
 percona-release setup ps80
Note: To avoid conflicts with older product versions, the percona-release setup command may disable our original repository for some products.
For more information, please visit:
  https://www.percona.com/doc/percona-repo-config/percona-release.html
Processing triggers for man-db (2.9.4-2) ..

1.4 Refresh the local cache to update the package information

$  sudo apt update  
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease

1.5 Set up the repository for the Percona Server for MySQL 8.0

$  sudo percona-release setup ps80    
* Disabling all Percona Repositories
* Enabling the Percona Server 8.0 repository
* Enabling the Percona Tools repository
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
/etc/apt/sources.list:12 and /etc/apt/sources.list:18
$ sudo apt update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Building dependency tree... Done

1.6  Check the available Percona Server for MySQL 8.0 version 

$ sudo apt list -a percona-server-server     #
Listing... Done
percona-server-server/stable 8.0.32-24-1.bullseye amd64
percona-server-server/stable 8.0.31-23-1.bullseye amd64
percona-server-server/stable 8.0.30-22-1.bullseye amd64
percona-server-server/stable 8.0.29-21-1.bullseye amd64
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

$sudo apt install  percona-server-server=8.0.28-20-1.bullseye  percoa-server-common=8.0.28-20-1.bullseye  percona-server-client=8.0.28-20-1.bullseye 
Reading package lists... Done
The following NEW packages will be installed:
  debsums libaio1 libfile-fnmatch-perl libmecab2 percona-server-client percona-server-common percona-server-server
0 upgraded, 7 newly installed, 0 to remove and 65 not upgraded.
Need to get 68.1 MB of archives.
After this operation, 491 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
pdate-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Choose authentication method etc
 * Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.
 * Run the following commands to create these functions:
mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"
mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"
mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"
 * See http://www.percona.com/doc/percona-server/8.0/management/udf_percona_toolkit.html for more details
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Processing triggers for man-db (2.9.4-2) ...
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.

$ mysql
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 8
Server version: 8.0.28-20 Percona Server (GPL), Release '20', Revision 'fd4b5a776a6'
Copyright (c) 2009-2022 Percona LLC and/or its affiliates
Copyright (c) 2000, 2022, 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> 
$ tail -100 /var/log/mysql/error.log
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.
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
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
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.

$ systemctl stop mysql 
$ cp  /etc/mysql/my.cnf   .    # backup  the my.cnf 
$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 
$ 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 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be upgraded:
 percona-server-client percona-server-common percona-server-server
3 upgraded, 0 newly installed, 0 to remove and 65 not upgraded.
Need to get 133 MB of archives.
After this operation, 10.1 MB of additional disk space will be used.
Get:1 http://repo.percona.com/ps-80/apt bullseye/main amd64 percona-server-server amd64 8.0.30-22-1.bullseye [112 MB]
(Reading database ... 137005 files and directories currently installed.)
Preparing to unpack .../percona-server-server_8.0.30-22-1.bullseye_amd64.deb ...
Unpacking percona-server-server (8.0.30-22-1.bullseye) over (8.0.28-20-1.bullseye) ...
Preparing to unpack .../percona-server-client_8.0.30-22-1.bullseye_amd64.deb ...
Unpacking percona-server-client (8.0.30-22-1.bullseye) over (8.0.28-20-1.bullseye) ...
Preparing to unpack .../percona-server-common_8.0.30-22-1.bullseye_amd64.deb ...
Unpacking percona-server-common (8.0.30-22-1.bullseye) over (8.0.28-20-1.bullseye) ...
Setting up percona-server-common (8.0.30-22-1.bullseye) ...
Setting up percona-server-client (8.0.30-22-1.bullseye) ...
Setting up percona-server-server (8.0.30-22-1.bullseye) ...
 * See http://www.percona.com/doc/percona-server/8.0/management/udf_percona_toolkit.html for more details
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u6) ...
$tail -20 /var/log/mysql/error.log
2023-06-05T23:34:27.813809Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-20) starting as process 4103
2023-06-05T23:34:27.907429Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-06-06T00:01:09.725417Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-22) starting as process 4657
2023-06-06T00:01:09.751320Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-06-06T00:01:43.835245Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-06-06T00:01:53.233780Z 4 [System] [MY-013381] [Server] Server upgrade from '80028' to '80030' started.
2023-06-06T00:02:10.305075Z 4 [System] [MY-013381] [Server] Server upgrade from '80028' to '80030' completed.
2023-06-06T00:02:19.030342Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
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.
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
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'.

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. Download the specific Percona Server for MySQL 8 tarball packages and install them manually

2.1 Install Percona Server for MySQL 8.0.31 with tarball packages

$sudo apt-get install libaio1
$ls -al 
percona-server-client_8.0.31-23-1.buster_amd64.deb
percona-server-common_8.0.31-23-1.buster_amd64.deb
percona-server-server_8.0.31-23-1.buster_amd64.deb
$sudo dpkg -i *deb
$ tail -100  /var/log/mysql/error.log
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.
2023-06-07T05:41:22.968297Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-23) starting as process 15337
2023-06-07T05:41:22.986337Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-06-07T05:49:49.026256Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
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'.

2.2  Upgrade Percona Server for MySQL 8.0.31 to 8.0.32 with tarball packages 

percona-server-client_8.0.32-24-1.bullseye_amd64.deb
percona-server-common_8.0.32-24-1.bullseye_amd64.deb
percona-server-server_8.0.32-24-1.bullseye_amd64.deb
$dpkg -i *.deb
(Reading database ... 137007 files and directories currently installed.)
Preparing to unpack percona-server-client_8.0.32-24-1.bullseye_amd64.deb ...
Unpacking percona-server-client (8.0.32-24-1.bullseye) over (8.0.31-23-1.buster) ...
Preparing to unpack percona-server-common_8.0.32-24-1.bullseye_amd64.deb ...
Unpacking percona-server-common (8.0.32-24-1.bullseye) over (8.0.31-23-1.buster) ...
Preparing to unpack percona-server-server_8.0.32-24-1.bullseye_amd64.deb ...
Unpacking percona-server-server (8.0.32-24-1.bullseye) over (8.0.31-23-1.buster) ...
Setting up percona-server-common (8.0.32-24-1.bullseye) ...
Setting up percona-server-client (8.0.32-24-1.bullseye) ...
Setting up percona-server-server (8.0.32-24-1.bullseye) ...
mysql>
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 10
Server version: 8.0.32-24 Percona Server (GPL), Release '24', Revision 'e5c6e9d2'
mysql> s
--------------
mysql  Ver 8.0.32-24 for Linux on x86_64 (Percona Server (GPL), Release '24', Revision 'e5c6e9d2')
tail -100  /var/log/mysql/error.log
2023-06-07T23:07:42.007827Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-06-07T23:12:04.925749Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-06-07T23:12:29.929705Z 4 [System] [MY-013381] [Server] Server upgrade from '80031' to '80032' started.
2023-06-07T23:12:42.281359Z 4 [System] [MY-013381] [Server] Server upgrade from '80031' to '80032' completed.
2023-06-07T23:12:43.321008Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
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.
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
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'.

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.

$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.25-1_all.deb
$sudo dpkg -i mysql-apt-config_0.8.25-1_all.deb
$sudo apt-get update
$sudo apt list -a  mysql-server
Listing... Done
mysql-server/unknown 8.0.33-1debian11 amd64
$sudo apt-get install mysql-server

We could install/upgrade to MySQL 8 specific version with deb packages as below.  

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_8.0.27-1debian11_amd64.deb-bundle.tar
$tar -xvf mysql-server_8.0.27-1debian11_amd64.deb-bundle.tar
$dpkg -i libmysqlclient21_8.0.27-1debian11_amd64.deb
$dpkg -i mysql-common_8.0.27-1debian11_amd64.deb
$dpkg -i mysql-community-client-plugins_8.0.27-1debian11_amd64.deb
$dpkg -i mysql-community-client-core_8.0.27-1debian11_amd64.deb
$dpkg -i mysql-community-client_8.0.27-1debian11_amd64.deb
$dpkg -i mysql-client_8.0.27-1debian11_amd64.deb
$dpkg -i mysql-community-server-core_8.0.27-1debian11_amd64.deb
$dpkg -i mysql-community-server-core_8.0.27-1debian11_amd64.deb
$dpkg -i mysql-community-server_8.0.27-1debian11_amd64.deb
$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.

#hold the percona mysql version
sudo apt-mark  hold percona-server-client
sudo apt-mark  hold percona-server-common
sudo apt-mark  hold percona-server-server
#show hold
sudo apt-mark  showhold
percona-server-client
percona-server-common
percona-server-server
#unhold the percona mysql version, then we could upgrade to another version
sudo apt-mark  unhold percona-server-client
sudo apt-mark  unhold percona-server-common
sudo apt-mark  unhold percona-server-server
#For percona mysql , you could also  replace step 1.5
$sudo percona-release setup ps80  
$sudo percona-release setup pdps-8.0.28
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.
-== below is for MySQL community 
#show hold
$apt-mark showhold   
libdbd-mysql-perl
libmariadb3
mariadb-common
mysql-client
mysql-common
mysql-community-client
mysql-community-client-core
mysql-community-client-plugins
mysql-community-server
mysql-community-server-core
mysql-server
# hold the packages 
sudo apt-mark hold libdbd-mysql-perl
sudo apt-mark hold libmariadb3
sudo apt-mark hold mariadb-common
sudo apt-mark hold mysql-client
sudo apt-mark hold mysql-common
sudo apt-mark hold mysql-community-client
sudo apt-mark hold mysql-community-client-core
sudo apt-mark hold mysql-community-client-plugins
sudo apt-mark hold mysql-community-server
sudo apt-mark hold mysql-community-server-core
sudo apt-mark hold mysql-server
sudo apt-mark hold libmysqlclient-dev
sudo apt-mark hold libmysqlclient21
# unhold the packages 
sudo apt-mark unhold libdbd-mysql-perl
sudo apt-mark unhold libmariadb3
sudo apt-mark unhold mariadb-common
sudo apt-mark unhold mysql-client
sudo apt-mark unhold mysql-common
sudo apt-mark unhold mysql-community-client
sudo apt-mark unhold mysql-community-client-core
sudo apt-mark unhold mysql-community-client-plugins
sudo apt-mark unhold mysql-community-server
sudo apt-mark unhold mysql-community-server-core
sudo apt-mark unhold mysql-server
sudo apt-mark unhold libmysqlclient-dev
sudo apt-mark unhold libmysqlclient21

Conclusion

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!

Try Percona Distribution for MySQL today!

Share This Post!

Subscribe
Connect with
guest
Label
0 Comments

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK