Monday, May 9, 2011

If you haven't used the MySQL Sandbox... No need to wait...



The MySQL Sandbox tool is a fantastic way to evaluate and install different versions of MySQL. Often when new versions of software come out people tend to be very nervous to upgrade and test with their current stable server environments. You just might not be able to take a risk and upgrade a development or slave servers to test evaluate a new version.
 
 Giuseppe Maxia “The Data Charmer” has built the MySQL Sandbox (http://mysqlsandbox.net/) to help you avoid these risks. This is just one of the many things Giuseppe does for the MySQL community.

Code is available via Launchpad or CPAN.

Documentation can be found here: http://mysqlsandbox.net/docs.html. In my opinion CPAN contains most of the documentation you would need: http://search.cpan.org/~gmax/MySQL-Sandbox-3.0.12/lib/MySQL/Sandbox.pm

Once installed you can then easily run different versions of MySQL to test queries and review options , this does include replication as well.



Here is a brief overview of an install. 
   cd ~/Downloads/
    tar -vxzf MySQL-Sandbox-3.0.12.tar.gz
    cd MySQL-Sandbox-3.0.12
    perl Makefile.PL
    make
    make install
 
    mkdir ~/sandboxes
    cd ~/Downloads/

A quick download of the code from labs.mysql.com for example followed by this command :

   make_sandbox mysql-5.6.2-labs-innodb-memcached-linux2.6-x86_64.tar.gz

    “Your sandbox server was installed in $HOME/sandboxes/msb_5_6_2”

So I now have 2 versions of MySQL installed and ready for review.

   mysql -p 
         Server version: 5.5.11-log MySQL Community Server (GPL)

   cd $HOME/sandboxes/msb_5_6_2
   ./use 
    Server version: 5.6.2-labs-innodb-memcached MySQL Community Server (GPL)


For testing purposes you can then take a db or tables and use them in your sandbox. 
      mysqldump -p db_example > db_example.sql

      cd $HOME/sandboxes/msb_5_6_2
   ./use -e "create database db_example"
   ./use db_example < db_example.sql

I am now able to adjust mysql settings in 5.6.2  ($HOME/sandboxes/msb_5_6_2/my.sandbox.cnf)  and test queries on the same data.




Giuseppe has help from his team as well all of whom can be seen here: https://launchpad.net/mysql-sandbox/+topcontributors


Many thanks to Giuseppe and all of your contributors for the sandbox.