In laboratory environments is very useful run two or more instances of MySQL for test new versions, configurations or test a master-slave replication using the same system, we can get this through MySQL Sandbox. MySQL Sandbox is a script written in perl that install multiple MySQL isolated instances with own settings for each instance and listening on different ports. For do this we need to install the script and download tarball of MySQL version that we need to install. I’ll show the basic deployment of one instance and the configuration of two basic instances for two different system users.

Installing MySQL sandbox

1.- Download and unpack the mysql sandbox script:

# mkdir /mysql-sandbox
# cd /mysql-sandbox ; wget https://launchpad.net/mysql-sandbox/mysql-sandbox-3/mysql-sandbox-3/+download/MySQL-Sandbox-3.0.25.tar.gz
# tar -xzvf MySQL-Sandbox-3.0.25.tar.gz

2.- Installation:

# cd MySQL-Sandbox-3.0.25/
# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for MySQL::Sandbox
# make
# make test && make install

Manage commands for MySQL sandbox:

3.- Download the latest version of MySQL:

# wget -O /mysql-sandbox/mysql-5.5.27-linux2.6-i686.tar.gz http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.27-linux2.6-i686.tar.gz/from/http://cdn.mysql.com/

4.- Install MySQL dependency:

# apt-get install libaio1

Create our sandbox instance

$ /usr/local/bin/make_sandbox /mysql-sandbox/mysql-5.5.27-linux2.6-i686.tar.gz
unpacking /mysql-sandbox/mysql-5.5.27-linux2.6-i686.tar.gz
Executing low_level_make_sandbox --basedir=/mysql-sandbox/5.5.27 
--sandbox_directory=msb_5_5_27 
--install_version=5.5 
--sandbox_port=5527 
--no_ver_after_name 
--my_clause=log-error=msandbox.err

Starting our instance

$ /mysql-sandbox/5.5.27/scripts/mysql_install_db --user=usu1 --ldata=/home/usu1/sandboxes/msb_5_5_27/data --basedir=/mysql-sandbox/5.5.27
$ /home/usu1/sandboxes/msb_5_5_27/start

Configuration for two instances of MySQL SandBox

/home/usu1/sandboxes/msb_5_5_27/my.sandbox.cnf

/home/usu2/sandboxes/msb_5_5_27/my.sandbox.cnf

Official project web page:

http://mysqlsandbox.net/

configuring MySQL Sandbox
Tagged on:     

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow

Get every new post delivered to your Inbox

Join other followers: