You are here

MyEnv Installation Guide

This article will cover the installation of the MyEnv, a tool of FromDual.

Why MyEnv?

MyEnv is a bundle of scripts to run multiple MySQL, Percona Server or MariaDB database instances on the same server with ease. You can even run multiple database instances with different binary versions.


  • A working Linux
  • PHP
  • A dedicated user


  • php-cli
  • php-mysqli (provided by RPM "php-mysql")
  • php-posix (provided by RPM "php-process")
  • redhat-lsb-core


  • php5-cli
  • php5-mysql


  • php5-posix
  • php5-pcntl
  • php5-mysql

Text within one of those boxes is command line input or output.


First you have to set up the user and the group:

groupadd mysql
useradd -g mysql -d /home/mysql mysql

MyEnv will be run as the user mysql, just like any regular mysqld process.

You might want to check, if the home directory of the user mysql was created at the right place. If not, you can use the following commands to create it:

mkdir /home/mysql
chown -R mysql:mysql /home/mysql

Next ist the directory where the MyEnv configuration will be located. DO NOT FORGET to give the mysql user read and write permission for this directory.

mkdir /etc/myenv/
chown -R mysql:mysql /etc/myenv/
chmod 722 /etc/myenv

Switch the user ...

su - mysql

... and create some more folders in his home directory:

mkdir ~/product
mkdir ~/data
mkdir ~/download

  • In product you want to place the unpacked binaries, because that's where myenv goes looking for them by default.
  • download is intended to be used as landing zone for downloads, such as fresh binaries.
  • data usually contains the datadir of the instances.


Now download MyEnv:

cd ~/download

Once the archive has finished downloading, you can move on to the installation.


To install MyEnv you have to unarchive it. It is recommended to do that in the product directory.

cd ~/product
tar xf ../download/myenv-latest.tar.gz
ln -s myenv-x.y/ myenv

If you want to create the link is up to you, but it makes writing easier.

In the file /etc/php5/cli/php.ini, change the setting variables_order to EGPCS.


If you want to configure MyEnv you have to run the following command:


After you have issued this command, follow the steps through the setup. If you already have binaries available, you get the possibility to create a new database instance.


This paragraph is for all those who want to upgrade to a newer version.

su - mysql
cd ~/download
cd ~/product
tar xf ../download/myenv-x.y.tar.gz
unlink myenv
ln -s myenv-x.y myenv

You are basically going to to re-install MyEnv, but with a newer version.

How myenv works

It is always recommended to work as user mysql.

When you login you will see the current status:

Up       : mysqld523 (5.2.3)

Down     : mysqld5115 (5.1.16) mysqld5037 (5.0.37) mysqld4027 (4.0.27)
           mysqld4122 (4.1.22)

mysqld523 (3323)  : cacti mysql test
mysqld5116 (3325)  : cluster_test mysql test
mysqld5037 (3307)  : mysql test
mysqld4027 (3320)  : mysql test
mysqld4122 (3319)  : mysql test FoodMart

mysql@master:~ [mysqld523, 3323]>


Following you can find the most important commands for you:

<instance> : Switches to the environment for this instance. For example:
             shell> mysqld5116
u or up    : Lists, which releases are available, which instances are up and
             down and which instance contains which database. For example:
             shell> u
start      : Starts the actual or a specific instance. For example:
             shell> start
             shell> start mysqld5116
stop       : Stops the actual instance or a specific instance. For example:
             shell> stop
             shell> stop mysqld5116
restart    : restarts the actual or a specific instance. For example:
             shell> restart
             shell> restart mysqld5116
V          : print the current MyEnv version
cdh, cdb   : cd to the basedir of this instance.
cdd        : cd to the datadir of this instance.
cdc        : cd to the cluster-directory of this instance.
cde        : cd to the myenv-directory.
cd a b     : cd to a directory with the name where a is substituted by b.
             For example:
             shell> pwd /var/lib/mysql1
             shell> cd 1 2
             shell> pwd /var/lib/mysql2
ll         : ls -l
la         : ls -la


To enable debugging, please issue the following command on the command line:

export MYENV_DEBUG=1

To disable the debug mode, use the following command:


In case you found a bug, please report it here: FromDual bug tracker