Bug #63433 RHEL5: MySQL-server RPM rather than MySQL-client one provides `mysql'
Submitted: 25 Nov 2011 19:29 Modified: 7 Feb 2013 14:30
Reporter: Ivan Pozdeev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.5.18 OS:Linux (RHEL 5/CentOS 5)
Assigned to: Assigned Account CPU Architecture:Any

[25 Nov 2011 19:29] Ivan Pozdeev
Description:
In RHEL5 RPMs, MySQL-server provides and obsoletes `mysql' and `MySQL'.
However, in RHEL5 and CentOS 5, `mysql' means mysql client rather than server.

This leads to yum behaving like this:

# yum upgrade
<...>
===============================================================================
 Package                   Arch       Version               Repository     Size
===============================================================================
Installing:
<...>
 MySQL-server              i386       5.5.16-1.rhel5        <private>      52 M
     replacing  mysql.i386 5.0.77-4.el5_6.6

as well as attempting to install the server package for anything that requires `mysql'.

In EL6, the situation looks the same.

How to repeat:
1) Install a stock mysql package (make sure it's older than 5.5.18). You can get one for CentOS 5.7 at http://mirror.centos.org/centos-5/5.7/os/`uname -i`/CentOS/mysql-5.0.77-4.el5_6.6.`uname -i`.rpm

2) set up a private repository, e.g.:
# ( set -o errexit; set -o xtrace; yum -y install httpd yum-utils wget; service httpd start; pushd /var/www/html/; mkdir repo; cd repo; wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.18-1.rhel5.`uname -i`.rpm/from/http://mirror.leaseweb.com/mysql/; wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.18-1.rhel5.`uname -i`.rpm/from/http://mirror.leaseweb.com/mysql/; popd; createrepo /var/www/html/repo; echo '[private]
name=Private
baseurl=http://localhost/repo/
gpgcheck=0
enabled=1' >/etc/yum.repos.d/private.repo; )

3) try to upgrade mysql using the repository:
# yum --disablerepo=\* --enablerepo=private upgrade mysql

<...>
Installing:
 MySQL-server            i386            5.5.18-1.rhel5   private 52 M
     replacing  mysql.i386 5.0.77-4.el5_6.6

Suggested fix:
The patch to the .spec is trivial:

--- /usr/src/redhat/SPECS/mysql.5.5.18.spec.orig        2011-11-25 22:49:05.000000000 +0400
+++ /usr/src/redhat/SPECS/mysql.5.5.18.spec     2011-11-25 22:49:50.000000000 +0400
@@ -283,8 +283,8 @@
 Summary:       MySQL: a very fast and reliable SQL database server
 Group:         Applications/Databases
 Requires:      %{distro_requires}
-Provides:      msqlormysql mysql MySQL mysql-server MySQL-server
-Obsoletes:     mysql MySQL mysql-server MySQL-server
+Provides:      msqlormysql mysql-server MySQL-server
+Obsoletes:     mysql-server MySQL-server
 Obsoletes:     MySQL-server-classic MySQL-server-community MySQL-server-enterprise
 Obsoletes:     MySQL-server-advanced MySQL-server-advanced-gpl MySQL-server-enterprise-gpl

@@ -316,8 +316,8 @@
 %package -n MySQL-client%{product_suffix}
 Summary:       MySQL - Client
 Group:         Applications/Databases
-Provides:      mysql-client MySQL-client
-Obsoletes:     mysql-client MySQL-client
+Provides:      mysql MySQL mysql-client MySQL-client
+Obsoletes:     mysql MySQL mysql-client MySQL-client
 Obsoletes:     MySQL-client-classic MySQL-client-community MySQL-client-enterprise
 Obsoletes:     MySQL-client-advanced MySQL-client-advanced-gpl MySQL-client-enterprise-gpl
[25 Nov 2011 19:33] Ivan Pozdeev
Whoops, the shell command got split into lines. There shouldn't be any newlines till "echo '[private]" .
[16 Dec 2011 12:41] Joerg Bruehe
This is a difference in the RPM conventions between RedHat stype and MySQL style.
("MySQL style" refers to packages coming from the MySQL Build team at MySQL AB -> Sun -> Oracle, available via the MySQL download site and its mirrors.)

I will have to check whether that is a recent change, or a long-standing difference. As I have some other high-priority tasks just now, it will take some days till I get to that.

For now, all I can say is that an upgrade from RedHat style RPMs to MySQL style ones cannot be handled by "rpm -U", the MySQL style spec file protects against that. The reason is that they differ in the socket conventions and the file system layout (amongst other things), so users will need to check their applications when doing such a package switch.

For more details, see bug#28555.
[17 Dec 2011 15:07] Ivan Pozdeev
>This is a difference in the RPM conventions between RedHat stype and MySQL style.

This implies that your RPMs are incompatible with RHEL distribution.
Since you position .rhel5 RPMs for use in RHEL/CentOS 5 , they have to conform to their naming conventions to be inserted seamlessly - at least because

> [yum tries] to install the server package for anything that requires `mysql'
[26 Jan 2012 22:23] Chris Barbour
I experienced this issue while attempting to install MySQL 5.5.20 on a RHEL6.1 x86_64 system, I was able to resolve it using the following approach:

1. Download and install rpmrebuild, which permits editing the specfiles associated with prebuild binaries (necessary because no source is provided for MySQL-shared-compat)

2. Use rpmrebuild to make the following changes to MySQL-shared-compat-5.5.20-1.linux2.6.x86_64.rpm:

Replace:
Obsoletes:     MySQL-shared
Obsoletes:     mysql-shared
Provides:      MySQL-shared

With:
Obsoletes:     mysql-libs
Obsoletes:     MySQL-shared-compat
Obsoletes:     mysql-shared-compat
Provides:      mysql-libs
Provides:      MySQL-shared-compat

This change will cause MySQL-shared-compat to function as a drop in replacement for mysql-libs. This should meet any dependencies from existing software, such as perl-DBD-mysql and postfix.

The huyge benefit here is that if you issue a yum or RPM upgrade of both MySQL-server and MySQL-shared-compat at the same time, you will also avoid a number of conflicts between RHEL's mysql-libs and the provided MySQL-server 5.5 binary.

The change will also prevent MySQL-shared-compat from over-writing MySQL-shared.

I also made a modification to MySQL-client-5.5.20-1.linux2.6.x86_64.rpm, adding the following lines:

Obsoletes:     mysql
Provides:      mysql

This will cause it to upgrade the existing RHEL provided MySQL client.

This approach should solve a number of open bugs related to installing MySQL 5.5 on RHEL6.

Regards,
-- Chris Barbour, Taos
[26 Jan 2012 22:29] Chris Barbour
Strictly speaking, I should also bump the release revision while in there. :)
[7 Feb 2013 14:30] Ramesh Maddali
It was verified by Joerg then and now by Bala by upgrading from 5.5.28 to 5.5.29 and 5.5.30; did not encounter this issue.