Upgrading RHEL 6 to MySQL Server 5.5

Update: If you’re in the market for an upgrade from MySQL 5.1, consider jumping over to MariaDB, a drop-in replacement that is now standard on Fedora and other distributions, and will be replacing MySQL in RHEL 7. Instructions for setting up their yum repository for CentOS/RHEL are here.

The Problem

RHEL 6 ships with MySQL 5.1.6, and while RH does issue security patches as needed some features available in newer versions of MySQL can’t be had with even the updated rpms. For a long time the only choice admins had was to download a binary package from Oracle or compile a new one from source, but that creates a maintenance nightmare — especially on a high exposure Internet host.

Read on for a solution.

The Solution

The internal IT group at Rackspace came up with the answer: the IUS Community repo. This is a Rackspace-sponsored repository containing newer versions of important software than can be found upstream.

The current version of MySQL Server available from IUS for RHEL 6 is 5.5.28.

Enable the repo by installing the lastest repo rpm for the target platform:

ius-release-1.0-10.ius.el6.noarch.rpm

The above links to the one for x86_64. Download and run “rpm -ivh ius-release-1.0-10.ius.el6.noarch.rpm”.

The IUS repo requires that the system also be configured for the EPEL repo.

Because this repo “breaks the rules” in offering packages for software that’s already in the upstream distribution, installing those packages often requires using the “replace” rather than “update” or “install” method.

To be able to do this yum-plugin-replace (only available from the IUS repo) must be installed.

Replacing MySQL 5.1.6 with 5.5.28

After enabling the IUS repo you can replace the standard MySQL packages with the newer ones by issuing this command:

yum replace mysql-server --replace-with mysql55-server

What it looks like

After configuring to us IUS, this is what you’ll see:

[root@mine ius]# yum search mysql55

* * *

============================= N/S Matched: mysql55 =============================
mysql55-debuginfo.x86_64 : Debug information for package mysql55
mysql55.x86_64 : MySQL client programs and shared libraries
mysql55-bench.x86_64 : MySQL benchmark scripts and data
mysql55-devel.x86_64 : Files for development of MySQL applications
mysql55-embedded.x86_64 : MySQL as an embeddable library
mysql55-embedded-devel.x86_64 : Development files for MySQL as an embeddable
                              : library
mysql55-libs.x86_64 : The shared libraries required for MySQL clients
mysql55-server.x86_64 : The MySQL server and related files
mysql55-test.x86_64 : The test suite distributed with MySQL

  Name and summary matches only, use "search all" for everything.

If you run the replace command:

[root@mine ius]# yum replace mysql-server --replace-with mysql55-server
Loaded plugins: changelog, downloadonly, fastestmirror, refresh-packagekit,
              : replace, security
Loading mirror speeds from cached hostfile
 * elrepo: mirror.symnds.com
 * epel: mirror.us.leaseweb.net
 * ius: mirror.rackspace.com
 * rpmforge: mirror.us.leaseweb.net
 * sl: ftp2.scientificlinux.org
 * sl-security: ftp2.scientificlinux.org
 * sl6x: ftp2.scientificlinux.org
 * sl6x-security: mirror.anl.gov
Replacing packages takes time, please be patient...

WARNING: Unable to resolve all providers: ['libmysqlclient.so.16()(64bit)',
 'libmysqlclient.so.16(libmysqlclient_16)(64bit)', 'libmysqlclient_r.so.16()(64bit)',
 'libmysqlclient_r.so.16(libmysqlclient_16)(64bit)', 'mysql-libs(x86-64)',
'mysql(x86-64)', 'mysql-devel(x86-64)', 'ha_archive.so.0()(64bit)', 
'ha_blackhole.so.0()(64bit)', 'ha_example.so.0()(64bit)', 'ha_federated.so.0()(64bit)',
 'ha_innodb_plugin.so.0()(64bit)', 'mysql-server(x86-64)']

The above is normal (except for a bit of reformatting of the text by me so it fits in this space better). Go ahead and allow:

This may be normal depending on the package.  Continue? [y/N] y
Resolving Dependencies
--> Running transaction check
---> Package mysql.x86_64 0:5.1.61-4.el6 will be erased
---> Package mysql-devel.x86_64 0:5.1.61-4.el6 will be erased
---> Package mysql-libs.x86_64 0:5.1.61-4.el6 will be erased
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: redland-1.0.7-11.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: php-mysql-5.3.3-14.el6_3.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: redland-1.0.7-11.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: php-mysql-5.3.3-14.el6_3.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: MySQL-python-1.2.3-0.3.c1.1.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: MySQL-python-1.2.3-0.3.c1.1.el6.x86_64
---> Package mysql-server.x86_64 0:5.1.61-4.el6 will be erased
---> Package mysql55.x86_64 0:5.5.28-1.ius.el6 will be installed
--> Processing Dependency: mysqlclient16 for package: mysql55-5.5.28-1.ius.el6.x86_64
---> Package mysql55-devel.x86_64 0:5.5.28-1.ius.el6 will be installed
---> Package mysql55-libs.x86_64 0:5.5.28-1.ius.el6 will be installed
---> Package mysql55-server.x86_64 0:5.5.28-1.ius.el6 will be installed
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
--> Running transaction check
---> Package MySQL-python.x86_64 0:1.2.3-0.3.c1.1.el6 will be erased
---> Package mysql-connector-odbc.x86_64 0:5.1.5r1144-7.el6 will be erased
---> Package mysql55-server.x86_64 0:5.5.28-1.ius.el6 will be installed

Did it really erase MySQL-python and those other packages? No, not really.

--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package mysqlclient16.x86_64 0:5.1.61-1.ius.el6 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be erased
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package php-mysql.x86_64 0:5.3.3-14.el6_3 will be erased
---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be erased
--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-7.el6.x86_64
--> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-4.0-3.el6.x86_64
---> Package redland.x86_64 0:1.0.7-11.el6 will be erased
--> Processing Dependency: librdf.so.0()(64bit) for package: soprano-2.3.1-1.2.el6.x86_64
--> Running transaction check
---> Package cronie.x86_64 0:1.4.4-7.el6 will be erased
--> Processing Dependency: cronie = 1.4.4-7.el6 for package: cronie-anacron-1.4.4-7.el6.x86_64
---> Package mysql55-server.x86_64 0:5.5.28-1.ius.el6 will be installed
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be erased
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package redhat-lsb.x86_64 0:4.0-3.el6 will be erased
--> Processing Dependency: lsb >= 4.0 for package: google-chrome-stable-22.0.1229.94-161065.x86_64
---> Package soprano.x86_64 0:2.3.1-1.2.el6 will be erased
--> Running transaction check
---> Package cronie-anacron.x86_64 0:1.4.4-7.el6 will be erased
---> Package google-chrome-stable.x86_64 0:22.0.1229.94-161065 will be erased
---> Package mysql55-server.x86_64 0:5.5.28-1.ius.el6 will be installed
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be erased
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
elrepo/filelists_db                                      |  65 kB     00:00     
epel/filelists_db                                        | 6.4 MB     00:41     
google-chrome/filelists                                  | 1.1 kB     00:00     
google-talkplugin/filelists                              | 1.2 kB     00:00     
ius/filelists_db                                         | 152 kB     00:00     
rpmforge/filelists_db                                    | 2.2 MB     00:13     
sl/filelists_db                                          | 5.1 MB     01:32     
sl-security/filelists_db                                 | 1.7 MB     00:17     
sl6x/filelists_db                                        | 5.1 MB     00:34     
sl6x-security/filelists_db                               | 1.7 MB     00:10     
--> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch
--> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-20.el6.x86_64
--> Processing Dependency: /lib/lsb/init-functions for package: tomcat6-6.0.24-45.el6.noarch
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be erased
--> Processing Dependency: crontabs for package: webalizer-2.21_02-3.3.el6.x86_64
---> Package mysql55-server.x86_64 0:5.5.28-1.ius.el6 will be installed
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be erased
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package sysstat.x86_64 0:9.0.4-20.el6 will be erased
---> Package tomcat6.noarch 0:6.0.24-45.el6 will be erased
--> Processing Dependency: tomcat6 for package: tomcatjss-2.1.0-2.el6.noarch
--> Running transaction check
---> Package mysql55-server.x86_64 0:5.5.28-1.ius.el6 will be installed
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be erased
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.28-1.ius.el6.x86_64
---> Package tomcatjss.noarch 0:2.1.0-2.el6 will be erased
---> Package webalizer.x86_64 0:2.21_02-3.3.el6 will be erased
--> Finished Dependency Resolution
--> Running transaction check
---> Package mysql.x86_64 0:5.1.61-4.el6 will be erased
---> Package mysql-devel.x86_64 0:5.1.61-4.el6 will be erased
---> Package mysql-libs.x86_64 0:5.1.61-4.el6 will be erased
---> Package mysql-server.x86_64 0:5.1.61-4.el6 will be erased
---> Package mysql55.x86_64 0:5.5.28-1.ius.el6 will be installed
---> Package mysql55-devel.x86_64 0:5.5.28-1.ius.el6 will be installed
---> Package mysql55-libs.x86_64 0:5.5.28-1.ius.el6 will be installed
---> Package mysql55-server.x86_64 0:5.5.28-1.ius.el6 will be installed
---> Package mysqlclient16.x86_64 0:5.1.61-1.ius.el6 will be installed
--> Finished Dependency Resolution

Are you sure it didn’t erase all those packages?

Yes I am. It did not. Of course there’s no guarantee which will work… It all “depends” on whether library names changed or, more insidiously, if a needed method got deprecated.

Dependencies Resolved

================================================================================
 Package            Arch       Version               Repository            Size
================================================================================
Installing:
 mysql55            x86_64     5.5.28-1.ius.el6      ius                  9.0 M
 mysql55-devel      x86_64     5.5.28-1.ius.el6      ius                  170 k
 mysql55-libs       x86_64     5.5.28-1.ius.el6      ius                  783 k
 mysql55-server     x86_64     5.5.28-1.ius.el6      ius                  9.6 M
Removing:
 mysql              x86_64     5.1.61-4.el6          @sl-security/6.2     2.4 M
 mysql-devel        x86_64     5.1.61-4.el6          @sl-security/6.2     387 k
 mysql-libs         x86_64     5.1.61-4.el6          @sl-security/6.2     4.0 M
 mysql-server       x86_64     5.1.61-4.el6          @sl-security/6.2      25 M
Installing for dependencies:
 mysqlclient16      x86_64     5.1.61-1.ius.el6      ius                  3.8 M

Transaction Summary
================================================================================
Install       5 Package(s)
Remove        4 Package(s)

Total download size: 23 M
Is this ok [y/N]: 

What you’ll notice is that IUS winds up installing a modified version of the MySQL 5.1.6 client code, in order to preserve all those dependencies whose erasure prompted the warnings above. Pretty neat, eh?