Running Multiple MySQL versions

If you would like to run multiple versions of MYSQL on same server without making any changes to the existing system you should follow the below steps
First download the source the tar file from mysql.com.

$> 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.

To resolve this 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-pid_file=/usr/local/mysql/mysqld.pid
    -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 &

TO SET A PASSWORD FOR THE MySQL root USER

  /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
Trying 127.0.0.1... 

Connected to localhost. 

Escape character is '^]'. 

+ 4.0.26-logIE^*THL

You’ve done,  now you can copy mysql.server >> rc.d to start it when the server is rebooted.
Warning: Never use two servers that update data in the same databases.

permalinkRead More CommentComments (3) Catmysql server

3 Responses to “Running Multiple MySQL versions”

  1. Marble Host Says:

    Thanks very useful information

  2. Thangdd Says:

    Please help me,

    i do this help step by step:

    my older mysql’s version is 4.0.20.
    Now i download new version 5.0.67 from mysql.com.

    MySystem is
    checking build system type… i686-pc-linux-gnu
    checking host system type… i686-pc-linux-gnu
    checking target system type… i686-pc-linux-gnu
    gcc (GCC) 3.3.3 (Turbolinux 3.3.3-2)
    ….

    Before install the directory /user/local/mysql not existing.

    And I do step by step

    1. Download and exact by tar -xvzf command
    2. find ./ -type f | xargs perl -pi -w -e ’s/cnf/conf/g;’
    not error occurt but nothing done

    3. Config by command
    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-pid_file=/usr/local/mysql/mysqld.pid
    -with-unix-socket-path=/tmp/mysqlt.sock –localstatedir=/var/lib/mysqlt

    And nothing done. I dont know why???

    - Not existing file: ../support-files/my-medium.conf

    - My list file in /support-file/

    [gijutsu@chakb-www2 gijutsu]$ ls /usr/local/mysql/support-files/
    MacOSX/ RHEL4-SElinux/ my-large.cnf.sh mysql.server.sh
    Makefile binary-configure.sh my-medium.cnf.sh mysql.spec
    Makefile.am compiler_warnings.supp my-small.cnf.sh mysql.spec.sh
    Makefile.in magic mysql-5.0.67.spec mysqld_multi.server
    MySQL-shared-compat.spec my-huge.cnf.sh mysql-log-rotate.sh mysqld_multi.server.sh
    MySQL-shared-compat.spec.sh my-innodb-heavy-4G.cnf.sh mysql.server ndb-config-2-node.ini.sh

    Please Help me–!

  3. Web Hosting Jack Says:

    wow nicely explained..I will try it for sure..

Leave a Reply

CSS Template by RamblingSoul || Tomodachi theme by Theme Lab