Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:

Upgrading MySQL version 3 to 4 RedHat / Fedora

by Tony Smith on 2004-01-25 (UPDATED 2004-12-25)

As you know the version of MySQL that is supplied by default with Fedora and the Red Hat Enterprise Linux versions is 3.23-58 whereas the current stable production version is 4.1.7-0. With the prospect that we aren't likely to provided with rpms for this current version from Red Hat for the foreseeable future, how do we upgrade, whilst maintaing the format we are familiar with Fedora/Red Hat.

Step 1. Obtain the source

Obtain the source rpm from MySQL from

Step 2. Extract The Source

Once the source rpm has been downloaded, extract it using rpm -ivh as shown below:

rpm -ivh MySQL-4.1.7-0.src.rpm [ENTER]

This will extract the source tar file to /usr/src/redhat/SOURCES.

Now download the files mysql.init and my.cnf-def to /usr/src/redhat/SOURCES

Step 3. Build the rpms

Now we will build a new set of rpms, however we will not use the supplied spec file from MySQL, but instead we will use a customized version.

Download the file mysql4.1.spec to /usr/src/redhat/SPECS

We are now in the position to build our brand new mysql rpms. To do this change directory to /usr/src/redhat/SPECS

Now issue the command

rpmbuild -ba mysql4.1.spec [ENTER]

When issuing this command you may encounter some failed dependancies, install the requisite rpms and re-issue the above command.

Once the rpmbuild is in full swing, it takes a while for it all to compile....

However, anything around an hour the new rpms are ready to install. These can be found in the following directory /usr/src/redhat/RPMS/i386 and consist of the following:









You will also find that you now have your very own custom built source rpm in /usr/src/redhat/SRPMS


Step 4. Prevent Breaking Dependancies

Attempting to install these newly created RPMs at the momoent will prove troublesome hitting a number of failed dependancies such as php-mysql, qt-mysql .... etc. One option would be to install mysql-4.1, and then re-compile all the failed dependancies, and re-install the dependancies. However there is a far better method, for which thanks is owed to Kenneth Porter for pointing out, and supplying the MySQL-shared-compat.spec file.

To use this spec file, we need to obtain the standard mysql-3.23.58-9.i386.rpm NOT the source rpm. This rpm needs to be copied to /usr/src/redhat/SOURCES and MySQL-shared-compat.spec should be copied to /usr/src/redhat/SPECS

Once the above files have been copied to the correct locations simply build the mysql-shared-compat-3.23.58-9.i386.rpm by issuing the command shown below:

rpmbuild -ba MySQL-shared-compat.spec [ENTER]

This command should be entered when in the directory

This rpm only takes a short while to be created, the mysql-shared-compat-3.23.58-9.i386.rpm rpm is created in the directory


Step 5. Install The RPM(S)

To install your new rpm(s) change directory to, /usr/src/redhat/RPMS/i386 the first time we are installing these we need to force the installation, due to file confilcts between mysql-shared-compat-3.23.58-9.i386.rpm and the currently installed standard rpm. Also the mysql-shared-compat-3.23.58-9.i386.rpm rpm will only be required the once, and will not need to be recompiled for any further subsequent updates. Simply install your required rpms as shown below:

rpm -Uvh --force mysql-shared-compat-3.23.58-9.i386.rpm mysql-server-4.1.7-0FC2.i386.rpm [ENTER]

Step 6. Post Install

Currently the mysql-shared-compat-3.23.58-9.i386.rpm does not update the file

/etc/ so this has to accomplished manually. Add the following line to /etc/


Then execute the command ldconfig as shown below:

ldconfig [ENTER]

To start the mysql daemon simply enter the command:

service mysqld start [ENTER]

Note, if this is a completely new install of MySQL, then the first time that you run the service, MySQL will be initailized.

However, if this is an upgrade from MySQL version 3 then to take advantage of the new priviledge/security features follow the instructions set out at the following address

Pros and Cons


Latest stable production version of MySQL

Enhanced features of MySQL 4, such as union joins, primary, foreign key relations, improved security...

Using mysql-shared-compat-3.23.58-9.i386.rpm standard updates for applications such as php will work without the need to recompile.


Not part of the standard Fedora/RedHat distribution.