Introducing the MySQL Sandbox

by Giuseppe Maxia

This documentation is OBSOLETE.

Please refer to for up-to date material.

Installing a side instance of MySQL for testing purpose is a task that many administrators can perform without breaking a sweat. If you need to do that only once in a while, you need just to read the manual carefully, or to have some experience in this matter, and the task is accomplished quite easily.

If, however, your skills are below the Guru level, even to get this task done just once you may find yourself in trouble. And, let's face it, even experienced administrators, when they need to do this several times, with different versions of MySQL, may have trouble doing it right. It would be nice to have a tool that takes care of the dirty details for you and gets the job done quietly, without interfering with existing installations, and without side effects.

Such a tool exists, it's The MySQL Sandbox. It is a framework for testing features under any version of MySQL from 3.23 to 5.1. Whitout fuss, it will install one server under your home directory, and it will provide some useful commands to start and stop it, and to use it within the sandbox.

There are many reasons for installing a side server. One is testing a potentially dangerous application, and you don't want to try it on a production server. Another reason is to try different versions of MySQL on a piece of code when hunting a bug. Or you are a consultant, your customers are all using different versions of the DBMS, and you need to test your procedures in an environment that is as close as possible to the your clients are using. I don't know about you, but in my job I have all the above needs, sometimes all at once.


Imran Chaudhry
2006-05-26 04:25:00
Bonjourno Guiseppe, I just tried out the sandbox on a machine wrunning 4.0 in production and 5.0.21 in the sandbox. It worked like a charm (would we expect no less from a "datacharmer"?).

One thing I noticed that you might want to change in 1.6 is that in the default options file you have named the sandbox_directory to 'mysql_sandbox5_0' which is appended to 'install_version' of 5.0 to make a resultant dir called 'mysql_sandbox5_05.0'

Like you, I do MySQL consultantcy gigs and this is a useful tool to have.

Imran Chaudhry

Michael Shapiro
2006-06-20 08:03:33
Thanks for infromation. I am just looking for such a tool to make a safe debugging.
2006-08-02 09:33:57
One of the cases that may happen, but only in some Linux distributions, is that a old version sandbox will complain about something along the lines of not finding a file that actually exists.
Gerd Rein
2006-10-19 11:12:26
Well Guiseppe, greetings from Sweden. I just downloaded your tutorial on the sandbox and was hot and ready to do som serious studying, but I got as far as $ ./ and there the fun ended. I could not get that install file to work no matter what. When I use run in WindowsXp it opens the file as notebook file. Now that helps me a lot. The info file also states just run the file, but not how! I hope someone has an answer for me, I am aware that once you know how it is very simple.
Best regards, Gerd Rein.
2006-10-19 11:45:42
Greetings from Sardinia, Italy.
the requirements say that you need a Unix box for the Sandbox.
It does not work on Windows.


P.S. It's Giuseppe, not Guiseppe

Vic T
2007-04-10 23:50:53
This is great stuff.
One very useful application that I can see (and will try soon) is to put the sandbox on another physical hard drive, and run the sandbox as a MySQL slave of the production dB on the primary drive.

2008-05-08 04:37:02
I just cant get the ./start_replication working well.
It keeps telling me the following errors.
installing and starting master
Can't use string ("server-id=1") as an ARRAY ref while "strict refs" in use at ./ line 506.
error installing the master
unpacking /home/testuser/mysqlpackages/mysql-5.1.24-rc-freebsd6.0-x86_64.tar.gz
Executing ./ --basedir=/home/testuser/mysqlpackages/5.1.24 \
--sandbox_directory=msb_5_1_24 \
--install_version=5.1 \
--sandbox_port=5124 \
--no_ver_after_name \
--datadir_from=script \
--no_confirm \
--home_directory=/home/testuser/rsandbox_5_1_24 \
--sandbox_directory=master \
--sandbox_port=18539 \
--load_grants \
--prompt_prefix=master \
-c \
log-bin=mysql-bin \
-c \

The directory for replication is created but nothing inside.
Can anyone please advise?

Thank you.