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.

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

perl -MCPAN -e shell
install MySQL::Sandbox

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

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 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

  • 1 year 5 months ago
  • 1 year 5 months ago
  • 1 year 5 months ago
    php 8.x
  • 1 year 5 months ago
  • 1 year 5 months ago
    Drop Centos 5/6 stuff