Ubuntu – How to install specific version of MYSQL

aptinstallationMySQL

I'm trying to install mysql-server 5.0. because I want to install a program which depend on this version. I've surfed the net to find a solution but none of them worked. I'm really disappointed. I tried "apt-get install mysql-server=5.0.96-0ubuntu3" but it said "Version '5.0.96-0ubuntu3' for 'mysql-server' was not found". I found this package at http://packages.ubuntu.com/hardy/mysql-server-5.0
but I don't know how to use it. Is it a way that I can install it manually?
please help me!

Best Answer

Download desired MySql generic binaries for your platform from http://dev.mysql.com/downloads/mysql/ Then just install using simple linux script(run from /share directory where setup binaries are placed ) , refer below for a script i used for years , worked for 5.1,5.5,5.6

Note : 1.MySql 5.6 does not come with default 'my.cnf' therefore be careful 2. Make sure you uninstall any exiting MySql setup

e.g

#!/bin/sh
DOWNLOAD_DIR="/share"
ZIP_FILE=mysql-enterprise-5.1.55-linux-x86_64-glibc23.tar.gz
MYSQL_DIR=mysql-enterprise-5.1.55-linux-x86_64-glibc23

if test -f $DOWNLOAD_DIR/mysql-enterprise-5.1.55-linux-x86_64-glibc23.tar.gz; then
    echo "Starting MySql 64 bit install..."
elif test -f $DOWNLOAD_DIR/mysql-enterprise-5.1.55-linux-i686-glibc23.tar.gz; then
    echo "Starting MySql 32 bit install..."
    ZIP_FILE=mysql-enterprise-5.1.55-linux-i686-glibc23.tar.gz
    MYSQL_DIR=mysql-enterprise-5.1.55-linux-i686-glibc23
else
    echo "installation tar.gz not found, quitting..."
    exit 2
fi

groupadd mysql
useradd -g mysql mysql
cd /usr/local
gunzip < $DOWNLOAD_DIR/$ZIP_FILE | tar xf -
ln -s /usr/local/$MYSQL_DIR mysql
cd mysql
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
# bin/mysqld_safe --user=mysql &
cp /usr/local/$MYSQL_DIR/support-files/mysql.server /etc/init.d/mysql
#cp $DOWNLOAD_DIR/mysql-cnf.txt /etc/my.cnf
chmod 755 /etc/init.d/mysql
cp support-files/mysql-log-rotate /etc/logrotate.d
update-rc.d mysql defaults
/etc/init.d/mysql start
# create path links for most commonly used executables
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/mysqladmin
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
/usr/local/mysql/bin/mysqladmin -u root password 'xxxxx'
echo "Done"
exit 0
Related Question