Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm trying to get multiple instances of mysql running on a dev box for some testing. This guy is running ubuntu so the setup's a little different than our production setups.

I'd like to find the easiest way to basically sudo service start and have it use a different .cnf init file (other than the distro default location of /etc/mysql/my.cnf

Any ideas?

share|improve this question
    
+1 for making the necessary tweeks in Ubuntu in conjunction with the answer !!! –  RolandoMySQLDBA Sep 20 '11 at 22:34
add comment

2 Answers

up vote 3 down vote accepted

Have you looked into the mysqld_multi tool ?

This will allow you to run different configurations and different distros using the same configuration file (/etc/mysql/my.cnf) and you could adjust the init.d script to use the mysqld_multi commands instead of mysqld.

Another tool might be mysql sandbox, but I've never used that personally on any distro.

share|improve this answer
    
OK, nothing to add here, moving along. Oh yea, nice concise answer. +1 !!! –  RolandoMySQLDBA Sep 20 '11 at 18:44
1  
Actually Rolando, there is something to add :) I did get it going with mysqld_multi quite nicely. Apparently ubuntu runs app armor which protects various directories. Running mysql_install_db to my new datadir was failing even running as root. I had to update the apparmor config to allow the new paths appropriate access and then reload the apparmor config. –  atxdba Sep 20 '11 at 22:15
    
One after thought comment I thought would be worth pointing out for others stumbling across the solution to their problem is the implementation of their my.cnf w/ mysqld_mulit. In short you'll have to add a [mysqld1] and [mysqld2] section to differentiate. In my.cnt I just used an !include directive like [mysql1] !include /etc/mysql/instanceA.cnf [mysql2] !include /etc/mysql/instanceB.cnf So I can edit instanceA.cnf or *B.cnf and not wonder which section i'm editing in a globbed together single my.cnf file. (Sorry for the formatting, i still need to figure this out..) –  atxdba Sep 21 '11 at 3:11
add comment

I am in the same situation daily. Instead of using mysqld_multi, what works OK for me is installing each MySQL copy to a separate tree, then running mkdir -p data etc var/run var/log/mysql and copying-fixing paths in a skeleton my.cnf:

[mysqld]
basedir=/home/laurynas/usr/opt/mysql-5.5.12
log-error=/home/laurynas/usr/opt/mysql-5.5.12/var/log/mysql/error.log
socket=/home/laurynas/usr/opt/mysql-5.5.12/var/run/mysqld.sock
datadir=/home/laurynas/usr/opt/mysql-5.5.12/data

[mysqld_safe]
socket=/home/laurynas/usr/opt/mysql-5.5.12/var/run/mysqld.sock

[client]
socket=/home/laurynas/usr/opt/mysql-5.5.12/var/run/mysqld.sock

and finally running scripts/mysql_install_db. If several servers need to be running at once, then I throw in skip-networking or assign different TCP port too.

share|improve this answer
add comment

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.