MySQL Sandbox is a great tool for quickly deploying test MySQL instances, particularly if your daily work involves diagnosing problems across multiple MySQL versions.
Once you've downloaded it, it needs no installation. Just have a few MySQL binary releases at hand, and begin creating sandboxes in just a few seconds:
Pretty simple, huh?
Suppose you have a parallel build around, say, 5.0.77-percona-highperf. The default syntax won't work if you've already created a 5.0.77 sandbox, since Sandbox will use '5.0.77' as the sandbox dir. In this case, you'll need to manually specify a directory name:
./make_sandbox mysql-5.0.77-percona-highperf-b13.tar.gz -d msb_percona_5_0_77
Fortunately, all Sandbox commands have a --help option that provide helpful screens to let you know how you can modify their default behavior. In this particular case, you'll actually need to access the help for low_level_make_sandbox, since that's the script that's eventually called.
Once a sandbox is created, using it is real simple. Just cd to it's directory (by default, $HOME/sandboxes/$SANDBOXDIR) and issue one of the following commands:
- ./use (this invokes the sandbox's mysql client with appropriate parameters. you can append your own parameters too, i.e., a database name)
- ./clear (stops the server and removes everything from the data directory, leaving you ready to start from scratch)
It even includes an option to create replication sandboxes, with a master node and two slaves. This is by default, but you can also create multiple sandboxes of the same version and configure replication yourself.
Here's an example:
So there it is, once again, download it and start having fun!