July 3, 2007

How do I run both mysql 4 and 5 on the same LINUX server?

I am trying to make it so I can run a whmautopilot that is only compatable with mysql and my site that is only compatable with mysql 5. I am guessing its possible to install both.

  1. It takes a little doing but is definitely possible (I am running a 4.1 db and and 5.0 db on my Linux server). The steps I took were to start with a standard rpm install of 5.0.22 and the appropriate client libraries. You can then download the latest 4.1 GA release from the MySQL website, you want a non-RPM version for your machine.

    As always, make sure you have a backup of any existing databases before you start modifying your system.

    Follow the instructions for installing on a "Other Unix-Like Systems"
    http://dev.mysql.com/doc/refman/4.1/en/I…
    up until you get to the point where you would create the initial database. Don't run the mysql_install_db as specified in those instructions.

    You now need to decide where you will locate the database data files for your 4.1 installation. Choose a location and then create or modify an appropriate cnf/ini file so that mysql will know where to place the data files. Make sure that your cnf file specifies a port that won't conflict with your 5.0 installation. You can now run mysql_install_db with the –defaults-file option using the modified cnf/ini file. This option MUST be the first option specified or the script won't work properly. Something like
    mysql_install_db –defaults-file my4.1.cnf –user mysql
    For my own installation I do this for both the 5.0 and 4.1 databases because I wanted to put all of the 5.0 files in a non-standard location (I have custom cnf files for both databases).

    When starting the 4.1 version of mysql, don't use /etc/init.d/mysql or the services control panel. The /etc/init.d/mysql will already be configured for the 5.0 installation. Instead put an entry into rc.local that will look something like:
    /usr/local/mysql4.1/bin/mysqld… –defaults-file=my4.1.cnf &

    When connecting to the databases, you will need to explicitly specify the port/socket to use. You can use the 5.0 client libraries with the 4.1 server.

    Spend some time looking at the MySQL online documentation, you can find most of this information in there.

  2. You'd have to compile another instance using a different
    –prefix=/mysql5 or /mysql4

    you'd need to modify the my.conf on one or the other to change the listening port of the second instance to something other then the default 3306

    I am sure of these things to start.. I am sure other things will come up or blow up as you do it.

    There is a PDF file on the NET for MYSQL Administration.. It is about a 1200 pg book.. Well worth the time to find it.

  3. Not possible
  4. I would think if you set up chroot jails for them, and if you can set them up to listen on different ports, you might be able to do this. That's who I would approach it.

Tags: ,

Tell a Friend Today!

del.icio.us Digg Furl Reddit Ask BlinkList blogmarks Blogg-Buzz Google Ma.gnolia Netscape ppnow Rojo Shadows Simpy Socializer Spurl StumbleUpon Tailrank Technorati Windows Live Wists Yahoo! Help

Permalink • Print

Track this entry

RSS BlogPulse

RSS Technorati Cosmos

Related Searches

, , , ,