Sometimes it is desired to use particular software versions in production, and not necessary the latest ones. There may be several reasons for that, where I think the most common is when a new version should spend some time in testing or a staging environment before getting to production. In theory each new version is supposed to be better as usually it contains a handful of bug fixes and even new or improved functionality. However there is also a risk of some regression or a new bug introduction as a side effect of code changes.
Quite often DBAs want the same MySQL version to be installed on all database instances, regardless of what actually is the latest version available in the software provider’s repository. There are several ways to achieve this:
* download specific version packages manually and then install them,
* have custom local repository mirror where you decide when and which version gets there, and just update from there using yum/apt,
* have database instance images with all software prepared,
* point to a particular version just using default package-management utility.
My idea was to remind about this last method as maybe the least known one.
In this article I will focus on YUM as it seems this is the only one currently offering multiple versions from official repositories of Oracle and Percona MySQL variants. APT theoretically is also able to install older versions, but command “apt-cache madison …” returns only the latest one for me. For example using Oracle repo:
1 2 3 |
root@ubuntu-14:~# apt-cache madison mysql-community-server mysql-community-server | 5.6.22-2ubuntu14.04 | http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.6 amd64 Packages mysql-community | 5.6.22-2ubuntu14.04 | http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.6 Sources |
So let’s see how it looks like for YUM repositories. I have installed repositories from Oracle, MariaDB and Percona on Centos 6 test machine. This is what they offer for the main server package versions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
[root@localhost ~]# yum repolist repo id repo name status base CentOS-6 - Base 6,518 extras CentOS-6 - Extras 36 mariadb MariaDB 17 mysql-connectors-community MySQL Connectors Community 12 mysql-tools-community MySQL Tools Community 18 mysql56-community MySQL 5.6 Community Server 112 percona-release-noarch Percona-Release YUM repository - noarch 26 percona-release-x86_64 Percona-Release YUM repository - x86_64 432 updates CentOS-6 - Updates 530 repolist: 7,701 [root@localhost ~]# yum -q list available --showduplicates mysql-community-server.x86_64 Available Packages mysql-community-server.x86_64 5.6.15-1.el6 mysql56-community mysql-community-server.x86_64 5.6.16-1.el6 mysql56-community mysql-community-server.x86_64 5.6.17-4.el6 mysql56-community mysql-community-server.x86_64 5.6.19-2.el6 mysql56-community mysql-community-server.x86_64 5.6.20-4.el6 mysql56-community mysql-community-server.x86_64 5.6.21-2.el6 mysql56-community mysql-community-server.x86_64 5.6.22-2.el6 mysql56-community [root@localhost ~]# [root@localhost ~]# yum -q list available --showduplicates MariaDB-server.x86_64 Available Packages MariaDB-server.x86_64 10.0.15-1.el6 mariadb [root@localhost ~]# [root@localhost ~]# yum -q list available --showduplicates Percona-Server-server-56.x86_64 Available Packages Percona-Server-server-56.x86_64 5.6.13-rel61.0.461.rhel6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.14-rel62.0.483.rhel6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.15-rel63.0.519.rhel6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.16-rel64.0.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.16-rel64.1.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.16-rel64.2.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.17-rel65.0.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.17-rel66.0.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.19-rel67.0.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.20-rel68.0.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.21-rel69.0.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.21-rel70.0.el6 percona-release-x86_64 Percona-Server-server-56.x86_64 5.6.21-rel70.1.el6 percona-release-x86_64 |
So at least for both Oracle and Percona packages we can use yum to install several versions back (12 in case of Percona Server 5.6).
How can we do that? Let’s install Percona Server version 5.6.19. To get a full package name with it’s version, we join it’s name with version but the CPU family part needs to be removed or replaced to the end. So Percona-Server-server-56.x86_64 + 5.6.19-rel67.0.el6 -> Percona-Server-server-56-5.6.19-rel67.0.el6 or Percona-Server-server-56-5.6.19-rel67.0.el6.x86_64:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@localhost ~]# yum -q install Percona-Server-server-56-5.6.19-rel67.0.el6 Percona-Server-client-56-5.6.19-rel67.0.el6 Percona-Server-shared-56-5.6.19-rel67.0.el6 ============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: Percona-Server-client-56 x86_64 5.6.19-rel67.0.el6 percona-release-x86_64 6.8 M Percona-Server-server-56 x86_64 5.6.19-rel67.0.el6 percona-release-x86_64 19 M Percona-Server-shared-56 x86_64 5.6.19-rel67.0.el6 percona-release-x86_64 721 k Transaction Summary ============================================================================================================================= Install 3 Package(s) Is this ok [y/N]: y (...) [root@localhost ~]# rpm -qa|grep Percona Percona-Server-server-56-5.6.19-rel67.0.el6.x86_64 Percona-Server-client-56-5.6.19-rel67.0.el6.x86_64 Percona-Server |