Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I run multiple versions of MySQL on one server box? This is on a box running SUSE Enterprise Server 10. The initial installation of MySQL v5.0.45 was done via RPM. I am now being asked to setup a second MySQL running version 5.1.36 to run simultaneously with the previous version. I've downloaded the tarball for the binary distribution of MySQL v5.1.36.

I'm looking for specifics in how to set it up as well as any recommendations on managing the two different versions. Where I have one my.cnf or mutiple ones? Should I keep them in /etc or perhaps in the basedir of each MySQL instance? What is the best way to start and shutdown of both servers? etc.?

share|improve this question
1  
Would virtualization be an option ? –  Antoine Benkemoun Jul 30 '09 at 14:35
    
Virtualization is not an option. –  user7286 Jul 30 '09 at 16:36

2 Answers 2

up vote 0 down vote accepted

It works fine. Just specify separate conf, port, sock, etc. Personally, I would probably maintain a /etc/my.server1.cnf and /etc/my.server2.cnf for individual server settings. And for startup, just copy /etc/init.d/mysqld (or whatever it is called for Suse), and it should be just a matter of updating some variables to make the new script start the second server.

share|improve this answer
    
Hi Chad, I am now looking at working with your idea of 2 separate my.cnf files. Since I'm using two different versions of MySQL does the list below include everthing I'd need to specify in the my.server2.cnf file [mysqld] section: [mysqld] basedir = /opt/mysql port = 4444 datadir = /opt/mysql/data pid-file = /opt/mysql/data/mysql.pid socket = /opt/mysql/data/mysql.sock mysqld = /opt/mysql/bin/mysqld_safe ledir = /opt/mysql/bin mysqladmin = /opt/mysql/bin/mysqladmin user = mysql log-error=/opt/mysql/data/mysqld.log Thanks, Dave –  user7286 Aug 5 '09 at 18:42
1  
That didn't format very well. Why don't you update the question with the contents of the two files. Make sure to specify different paths for datadir, socket, and pid-file. –  Chad Huneycutt Aug 5 '09 at 18:59
    
I'm having a problem getting the /etc/init.d/mysql script to start the 2nd MySQL install. What do I need to change in it to have use an /etc/my.server2.cnf file instead of /etc/my.cnf which is always seems to grab instead? Thanks ~D. –  user7286 Aug 6 '09 at 19:48
    
I figured it out. I'll post another question if I run into problems. Thanks, Dave –  user7286 Aug 7 '09 at 14:51

You can use mysqlmanager or mysqld_multi. mysqlmanager is more powerful but mysqld_multi is much easier to set up, and it's usually my choice

You just need one /etc/my.cnf like this (from mysql manual):

[mysqld_multi]
mysqld     = /usr/local/bin/mysqld_safe
mysqladmin = /usr/local/bin/mysqladmin
user       = multi_admin
password   = multipass

[mysqld2]
socket     = /tmp/mysql.sock2
port       = 3307
datadir    = /usr/local/mysql/var2

[mysqld3]
socket     = /tmp/mysql.sock3
port       = 3308
datadir    = /usr/local/mysql/var3

[mysqld4]
# ...

man page: mysqld_multi — Manage Multiple MySQL Servers

share|improve this answer
    
I'm working on this solution. How do I configure the [client] section of the /etc/my.cnf? Do I just omit it completely and have each client pass in a port and socket? Other suggestions? Thanks, Dave –  user7286 Jul 30 '09 at 18:41
    
Unless there's something you want to put there, it's better not to use it and specify in each client to which of the instances you want to connect. [client] can be nice to change default user, or if you have only one instance in a non-standard port –  Jorge Bernal Jul 30 '09 at 19:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.