Running both MySQL 4 and 5 on a same box
I had to make a clone of a website on a development server. The site was running on MySQL 4 and dev server on version 5. Ideally, all queries would run fine, but a huge query with lots of joins was failing for some reason.
In order to keep a clone as is, I decided to try and install MySQL 4 along with version 5 on the same server.
On dev server MySQL 5 was installed using apt-get, and I installed MySQL 4 like this:
Download MySQL 4 source from a local mirror
$wget http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-4.1.22.tar.gz/from/http://mysql.blic.net/
Unpack and install
$tar zxvf mysql-4.1.22.tar.gz $sudo groupadd mysql $sudo useradd -g mysql mysql $cd mysql-4.1.22 $./configure --prefix=/usr/local/mysql $make $sudo make install $sudo cp ./support-files/my-medium.cnf /etc/my.cnf $cd /usr/local/mysql $sudo ./bin/mysql_install_db --user=mysql $sudo chown -R root . $sudo chown -R mysql var $sudo chgrp -R mysql .
Start the daemon
$sudo /usr/local/mysql/bin/mysqld_safe --user=mysql --port=3308 --sock=/tmp/mysql4.sock &
Connect to installed MySQL 4 using shell
$/usr/local/mysql/bin/mysql --socket=/tmp/mysql4.sock
Display database version
mysql> select version(); +------------+ | version() | +------------+ | 4.1.22-log | +------------+
To connect phpMyAdmin to MySQL 4 edit the phpMyAdmin config file and change server value ‘localhost’ to ‘:/tmp/mysql4.sock‘
From web interface just type ‘mysql’ for username, and leave password empty. (Do set a password for MySQL user later, this was just an example)
Comments Off
