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?

  • +1 for making the necessary tweeks in Ubuntu in conjunction with the answer !!! Sep 20, 2011 at 22:34

2 Answers 2


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.

  • OK, nothing to add here, moving along. Oh yea, nice concise answer. +1 !!! Sep 20, 2011 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, 2011 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, 2011 at 3:11

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:




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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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