MySQL Conf 2008 – MySQL Sandbox (Day 3)

Author Michael Tougeron on April 16, 2008

Posted under Events, mysql and tagged with , , ,

This morning’s first session is hosted by Giuseppe Maxia about MySQL Sandbox. This tool was created so that you can quickly & easily setup sandbox servers for testing MySQL. It installs side servers on a machine that is already running MySQL. Sandbox installs quickly without disturbing the existing MySQL installation.

The home for the MySQL Sandbox project is hosted on SourceForge.net. It is not an officially supported product which is why Giuseppe keeps it on SourceForge.

The Sandbox was designed so that you don’t have to go through the hassle, and potentially error prone, steps of setting up multiple sandbox databases. It’s very common for these manual installations to accidentally install in the same data directory (can corrupt your data) or install with the same port/socket (MySQL won’t start).

Details of installing and using after the break…

The simple installation steps for MySQL Sandbox automatically creates a new instance of MySQL with a sandboxed data directory, port, and socket. In order to use Sandbox’s express_install script you need to download and un-tar a copy of MySQL for each version you wish to install. The script by default uses $HOME/opt/mysql as its base directory so be sure to extract MySQL there. You can change the default source directory, but by being in your home directory it helps keep your instance separate from everyone else’s.

Next download and extract the MySQL Sandbox from SourceForge and run the following:
./express_install.pl {directory in $HOME/opt/mysql}
If you prefer, you can run ./express_install.pl /path/to/mysql/directory

You can setup replication or multiple instances by ./set_replication.pl and ./set_custom_many.pl respectively. You also have a variety of install options that can be found by adding –help to the commands.

One of the nice commands you can use once the sandbox is setup and running is “clear.” This command will reset the data and instance back to default so that you can start again from scratch. Running the “use” command will get you into the CLI of the appropriate instance. One thing to keep in mind is that the commands to interact with the sandboxes must be run from the installed directory. You also have access to some of the standard MySQL command line tools by running “my {sqldump|sqlbinlog|sqladmin}” (Note the space after my).

It seems like this would be a good system to use in conjunction with DBUnit. As I talked about yesterday, DBUnit can auto-load/populate data. By putting the two together you should have a very maintainable and separate testing environment.

Posted under Events, mysql

This post was written by Michael Tougeron on April 16, 2008

Tags: , , ,

Leave a Comment

You must be logged in to post a comment.

More Blog Posts