Sometimes we need to run multiple MySQL servers on single machine. That is mostly required in testing environments to test different aspects with different configurations. In this way one can test server without affecting others. So, if you want to run multiple MySQL you can use MySQL Sandbox which eases the whole process of installing and configuring the server. Here how will you do it.
First of all you need to install MySQL Sandbox. You can download it from https://launchpad.net/mysql-sandbox.
Then you need tar balls of MySQL server. You can download it from MySQL site.
After installing MySQL Sandbox you can run following script to install MySQL.
This script will tell you some information like port, user name, and password which you can use to login to MySQL after installation. After confirmation it will install and run MySQL. That’s it! You are up and running.
If you want to install another MySQL you can just run the following command.
make_sandbox /path/to/mysql-X.X.XX-osinfo.tar.gz –check_port
The –check_port option checks the first available port so it can install and run on that port. By default it will use the MySQL version as port. For example if you have MySQL version 4.1.20 it will run MySQL on port 4120. And if it is not available then it will try 4121.
MySQL Sandbox provides other useful scripts to manage the server. So installing and running multiple MySQL, even different versions, is that easy :)
You can find the complete documentation at http://forge.mysql.com/wiki/MySQL_Sandbox#Single_server_sandbox.