How to install specific version of MySQL?

6,843

There are several ways to install specific versions of MySQL

LATEST VERSION

To install the latest version as of today (MySQL 5.6.10) run this:

HOWMANYBITS=64
WHATOS=5
BINARY_VERSION=000
if [ ${HOWMANYBITS} -eq 32 ] ; then BINARY_VERSION=i386   ; fi
if [ ${HOWMANYBITS} -eq 64 ] ; then BINARY_VERSION=x86_64 ; fi
MYSQL_RELEASE=`curl -L http://www.mysql.com/downloads 2> /dev/null | grep 'Current Generally Available Release' | grep 'MySQL Community Server' | sed 's/.*Available Release://' | sed 's/)/ /g' | awk '{print $1}'`
MAJOR_RELEASE="`echo ${MYSQL_RELEASE} | sed 's/\./ /g' | awk '{print $1}'`.`echo ${MYSQL_RELEASE} | sed 's/\./ /g' | awk '{print $2}'`"
OS_VERSION=000
if [ ${WHATOS} -eq 0 ] ; then OS_VERSION=linux2.6 ; fi
if [ ${WHATOS} -eq 5 ] ; then OS_VERSION=rhel5    ; fi
if [ ${WHATOS} -eq 6 ] ; then OS_VERSION=el6    ; fi
RELEASE_TAG=1
DEVEL__RPM=http://www.mysql.com/get/Downloads/MySQL-${MAJOR_RELEASE}/MySQL-devel-${MYSQL_RELEASE}-${RELEASE_TAG}.${OS_VERSION}.${BINARY_VERSION}.rpm/from/http://mysql.mirrors.pair.com/
SHARD2_RPM=http://www.mysql.com/get/Downloads/MySQL-${MAJOR_RELEASE}/MySQL-shared-compat-${MYSQL_RELEASE}-${RELEASE_TAG}.${OS_VERSION}.${BINARY_VERSION}.rpm/from/http://mysql.mirrors.pair.com/
SHARED_RPM=http://www.mysql.com/get/Downloads/MySQL-${MAJOR_RELEASE}/MySQL-shared-${MYSQL_RELEASE}-${RELEASE_TAG}.${OS_VERSION}.${BINARY_VERSION}.rpm/from/http://mysql.mirrors.pair.com/
CLIENT_RPM=http://www.mysql.com/get/Downloads/MySQL-${MAJOR_RELEASE}/MySQL-client-${MYSQL_RELEASE}-${RELEASE_TAG}.${OS_VERSION}.${BINARY_VERSION}.rpm/from/http://mysql.mirrors.pair.com/
SERVER_RPM=http://www.mysql.com/get/Downloads/MySQL-${MAJOR_RELEASE}/MySQL-server-${MYSQL_RELEASE}-${RELEASE_TAG}.${OS_VERSION}.${BINARY_VERSION}.rpm/from/http://mysql.mirrors.pair.com/
PERL_LOCATION=ftp://ftp.de.netclusive.de/pub/parallels/Plesk/Expand/2.3.1/packages
PERL_FILE=perl-DBI-1.53-2.fc7.x86_64.rpm
PERL_URL=${PERL_LOCATION}/${PERL_FILE}
cd
MYSQL_INSTALL_FOLDER=MySQL_${MYSQL_RELEASE}_Install
rm -rf ${MYSQL_INSTALL_FOLDER}
mkdir ${MYSQL_INSTALL_FOLDER}
cd ${MYSQL_INSTALL_FOLDER}
wget ${PERL_URL}
wget ${DEVEL__RPM}
wget ${SHARD2_RPM}
wget ${SHARED_RPM}
wget ${CLIENT_RPM}
wget ${SERVER_RPM}
ls -lSr *.rpm
for RPM in `ls -lSr *.rpm | awk '{print $9}'` ; do rpm -Uvh --force ${RPM} ; done

SPECIFIC VERSION

To install a specific version, set the following:

  • MYSQL_VERSION (5.5, 5.1, 5.0)
  • MYSQL_VERSION_RELNUM

For example to get MySQL 5.1.66, run this:

MYSQL_VERSION=5.1
MYSQL_VERSION_RELNUM=66
MYSQL_VERSION_RELEASE=${MYSQL_VERSION}.${MYSQL_VERSION_RELNUM}
REDHAT_RELEASE=5
BINARY_VERSION=x86_64
PERL_LOCATION=ftp://ftp.de.netclusive.de/pub/parallels/Plesk/Expand/2.3.1/packages
PERL_FILE=perl-DBI-1.53-2.fc7.x86_64.rpm
PERL_URL=${PERL_LOCATION}/${PERL_FILE}
MYSQL_MIRROR=http://mysql.mirrors.pair.com/
MYSQL_MIRROR=http://mirror.trouble-free.net/mysql_mirror/
MYSQL_MIRROR=http:http://mysql.he.net/
MYSQL_MIRROR_INDEX=1
MYSQL_SHARE2_LIB=MySQL-shared-compat-${MYSQL_VERSION_RELEASE}-${MYSQL_MIRROR_INDEX}.rhel${REDHAT_RELEASE}.${BINARY_VERSION}.rpm
MYSQL_SHARED_LIB=MySQL-shared-community-${MYSQL_VERSION_RELEASE}-${MYSQL_MIRROR_INDEX}.rhel${REDHAT_RELEASE}.${BINARY_VERSION}.rpm
MYSQL_DEVEL__LIB=MySQL-devel-community-${MYSQL_VERSION_RELEASE}-${MYSQL_MIRROR_INDEX}.rhel${REDHAT_RELEASE}.${BINARY_VERSION}.rpm
MYSQL_CLIENT_LIB=MySQL-client-community-${MYSQL_VERSION_RELEASE}-${MYSQL_MIRROR_INDEX}.rhel${REDHAT_RELEASE}.${BINARY_VERSION}.rpm
MYSQL_SERVER_LIB=MySQL-server-community-${MYSQL_VERSION_RELEASE}-${MYSQL_MIRROR_INDEX}.rhel${REDHAT_RELEASE}.${BINARY_VERSION}.rpm
MYSQL_SHARE2_URL="http://dev.mysql.com/get/Downloads/MySQL-${MYSQL_VERSION}/${MYSQL_SHARE2_LIB}/from/${MYSQL_MIRROR}"
MYSQL_SHARED_URL="http://dev.mysql.com/get/Downloads/MySQL-${MYSQL_VERSION}/${MYSQL_SHARED_LIB}/from/${MYSQL_MIRROR}"
MYSQL_CLIENT_URL="http://dev.mysql.com/get/Downloads/MySQL-${MYSQL_VERSION}/${MYSQL_CLIENT_LIB}/from/${MYSQL_MIRROR}"
MYSQL_DEVEL__URL="http://dev.mysql.com/get/Downloads/MySQL-${MYSQL_VERSION}/${MYSQL_DEVEL__LIB}/from/${MYSQL_MIRROR}"
MYSQL_SERVER_URL="http://dev.mysql.com/get/Downloads/MySQL-${MYSQL_VERSION}/${MYSQL_SERVER_LIB}/from/${MYSQL_MIRROR}"
cd
MYSQL_INSTALL_FOLDER=MySQL_${MYSQL_VERSION_RELEASE}_Install
rm -rf ${MYSQL_INSTALL_FOLDER}
mkdir ${MYSQL_INSTALL_FOLDER}
cd ${MYSQL_INSTALL_FOLDER}
wget ${PERL_URL}
wget ${MYSQL_SHARE2_URL}
wget ${MYSQL_SHARED_URL}
wget ${MYSQL_DEVEL__URL}
wget ${MYSQL_CLIENT_URL}
wget ${MYSQL_SERVER_URL}
pwd
ls -l
for RPM in `ls -lSr *.rpm | awk '{print $9}'` ; do rpm -Uvh --force ${RPM} ; done

REPOSITORIES WITH OLDER VERSIONS

If these do not help, you can bum off of other repositories

You will have to script these yourself.

Share:
6,843

Related videos on Youtube

user85569
Author by

user85569

Updated on September 18, 2022

Comments

  • user85569
    user85569 over 1 year

    I installed from the repo, 5.0.77... including setup of PowerDNS (and the backend for MySQL). I tried setting up replication from my Master (which is MySQL 5.1.53) but it didn't work even though there were no errors, nothing got replicated.

    So the last resort is to try the same MySQL version on both the master and the slave (nb, only the slave has pdns installed)

    How would I go about installing MySQL 5.1.53? I tried downloading the rpm from MySQL (obviously the wrong one, didn't even include the mysql command to shell into the databases), but in turn screwed up the dependencies for pdns' mysql backend.

    I have the atomic repo which will install MySQL 5.5 (both on my Master server and Slave), but I don't want to do a major upgrade on the master right now as it's in production.

    Would love some advice!

    • Govindarajulu
      Govindarajulu almost 13 years
      Are both servers running CentOS 5? If so, where do the RPM's on the master come from?
    • user85569
      user85569 almost 13 years
      Yes, both are CentOS 5.5 64bit. The Master has "atomic" repo's whereas the slave has the default repo's that comes when you install the cloud server. The atomic repo has MySql 5.5 in it, I don't want to upgrade that far...only to 5.1.53, since I can't afford to update my production enviroment just yet and potentially screw things up
  • user85569
    user85569 almost 13 years
    Thanks, I eventually ditched the idea of replicating to different versions of MySQL as it was obviously failing. I also couldn't upgrade the one server, whereas using the same repo on the others would give them higher version numbers. Eventually I just settled with 2 servers replicating :)