Archive for the ‘MYSQL Server’ Category

How to run Several MySQL versions on same Machine

October 8th, 2009

If you want to test a MYSQL release or you may require a new version although you won’t want to make any changes in the existing system, you can easily run multiple versions of MySQL on the same Server. It let you compile the new MySQL server with different TCP/IP ports and Unix socket files and that can provide you independent MySQL installations for different customers..

Follow these process to run Several MySQL versions on same Machine ;

First you need to download the tar file from

$> tar xfz mysql.tar.gz
$> cd mysql.XX

* Important **
“/etc/my.cnf ” is the default file that is used by a mysql server. When the new version is tested it will load the default configuration’s in /etc/my.cnf.

Now you can replace every instance of ” cnf ” inside the source folder to ” conf ” by using this following command.

find ./ -type f | xargs perl -pi -w -e ‘s/cnf/conf/g;’

1) The default user generally is “mysql”. Add another user and group for example mysqlt for the new version of MySQL.

2) A typical ./configure command…

./configure –prefix=/usr/local/mysql –enable-local-infile
–with-tcp-port=4444 –with-mysqld-user=mysqlt
–with-base_dir=/usr/local/mysql –with-log=/usr/local/mysql/mysqld.log
-with-unix-socket-path=/tmp/mysqlt.sock –localstatedir=/var/lib/mysqlt


The new values you will use for your new MySQL server are:

Port number : 4444

mysql user : mysqlt

base_dir : /usr/local/mysql

data directory : /var/lib/mysqlt

log file : /usr/local/mysql/mysqld.log

3) Compile and Install

make && make install

4)Create your new MySQL config file.

cp support-files/my-medium.conf /etc/my.conf

cd /usr/local/mysql

bin/mysql_install_db –user=mysqlt
( this will install all the needed databases )
bin/mysqld_safe –user=mysqlt &


/usr/local/mysql/bin/mysqladmin -u root -h hostname password ‘new-password’

/usr/local/mysql/bin/mysqladmin -u root password ‘new-password’

5) To start the service

cd /usr/local/mysql

./share/mysql/mysql.server start

6) To test

#telnet localhost 4444

and you should see this

Connected to localhost.

Escape character is ‘^]’.

+ 4.0.26-logIE^*THL

Now you can copy mysql.server >> rc.d to start it when the server is rebooted.

once you go through those steps you can download and configure different mysql versions to use different values for port, data directory, mysql user, configuration file etc.

Important Note: You should make sure that you never have two servers that update data in the same databases.

GD Star Rating

Posted in MYSQL Server | Comments (7,842)