MySQL Sandbox

MySQL Sandbox is a tool that installs one or more MySQL servers within seconds, easily, securely, and with full control. Once installed, the sandbox is easily used and maintained, without using complex options. Replicated and multiple sandboxes can be used individually or all at once.

Installation
The easiest way to install MySQL Sandbox is to use CPAN:

perl -MCPAN -e shell
install MySQL::Sandbox
exit

MySQL Sandbox is meant to be run as a non-root user, so create one and switch to it:

adduser mysandbox
su mysandbox
cd ~

Download a binary tarball of MySQL. Latest version, at time of writing, was 5.1.41:

cd /extra/src
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.41-linux-i686-glibc23.tar.gz/from/http://mirror.csclub.uwaterloo.ca/mysql/

Create a single MySQL sandbox
Assuming you are logged in as the mysandbox user,

cd ~
make_sandbox  ~/mysql-5.1.41-linux-i686-glibc23.tar.gz

A bunch of configuration defaults will be displayed and you will be prompted to accept them. As this is our first sandbox, agree to the options and it will be installeded in /home/mysandbox/sandboxes/msb_5_1_41. The default MySQL port will be 5141, user and password will be msandbox, and the socket /tmp/mysql_sandbox5141.sock.
You can confirm that the new sandbox is functioning by logging into it using an already installed copy of MySQL and the sandbox's socket /usr/local/mysql/bin/mysql -u msandbox -p -S /tmp/mysql_sandbox5141.sock. However, a much easier way is the scripts that are installed in ~/sandboxes/msb_5_1_41/:

  • start - start the server
  • stop - stop the server
  • clear - remove any data so you can begin anew
  • use - a wrapper that runs the mysql command-line tool, connecting to the instance
    • Export a database:

      ./use db_name > /path/to/sql/dump
    • Import a database:
      ./use db_name < /path/to/sql/dump
    • send_kill - sends kill -TERM and then, if necessary kill -KILL to the server process
    • my - starts one of mysqldump, mysqladmin, mysqlbinlog using credentals from my_sandbox.cnf

    phpMyAdmin
    phpMyAdmin can be used to manage a sandbox's database. When configuring the server in phpMyAdmin:

    • Server port - eg. 5141
    • Server socket - eg. /tmp/mysql_sandbox5141.sock
    • Connection type - socket

    Extra Resources
    at Linux Magazine

Recent Updates

  • 3 months 3 weeks ago
  • 3 months 3 weeks ago
  • 3 months 3 weeks ago
    php 8.x
  • 3 months 3 weeks ago
    10.6.7
  • 3 months 4 weeks ago
    Drop Centos 5/6 stuff