Read more

Installing multiple MySQL versions on the same Linux with mysql-sandbox

Henning Koch
October 19, 2013Software engineer at makandra GmbH

Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home:

  1. Install mysql-sandbox
sudo apt install mysql-sandbox
  1. Download the version of MySQL you want to use from mysql.com:
    https://dev.mysql.com/downloads/file/?id=480427 Show archive.org snapshot
    Make sure to choose "Generic Linux" instead of "Ubuntu" so you get a .tar.gz instead of .deb

  2. cd into the directory the mysql binaries will be extracted to

mkdir -p ~/bin/sandbox_dist
cd ~/bin/sandbox_dist
  1. Build the sandbox
make_sandbox mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Note that make_sandbox will extract the files into the current folder and expects them to live there forever. That's why we switched to a persistent place like bin/sandbox_dist before.

On older distributions, make_sandbox might be mysql_sandbox instead.

This will install this version into /~/sandboxes/msb_5_7.21. The folder includes a command to start the MySQL daemon for that sandbox. It listens to a non-standard port, so it can run in parallel with your regular MySQL installation.

Note the console output when you install a sandbox. It will show the non-standard port and the username (default root) and password (default msandbox). When working on a Rails project, you need to paste all of that into your config/database.yml.

Connecting to a sandbox

mysql --user=root --password=msandbox --host=127.0.0.1 --port=1234

Replace 1234 with the port for the Sandbox.

Further reading

There is another card that describes how to achieve the same using docker.

Posted by Henning Koch to makandra dev (2013-10-19 16:47)