You can find this document as PDF here.

1. About

MyEnv is a tool to run several MySQL, MariaDB or PostgreSQL database instances on ONE host without using any virtualization or container technologies. You can even run multiple database instances with different versions on the same machine. We call this multi-instance set-ups.

With MyEnv a multi-instance set-up is more comfortable to handle than with mysqld_multi (old) or Systemd services (new) and it provides more useful functionality.

Using MyEnv does not need the use of the root user to operate a database instances. Thus it is appropriate for classical enterprise DBA organizations.

Further multi-instance set-ups is a much more efficient way of consolidating MySQL and MariaDB instances an has less overhead than virtualization solutions. To do proper resource fencing MyEnv provides cgroup integration (container integration (docker/incus/lxd) is planned in the future).

2. Installation Guide

2.1. Architecture overview

…​

2.2. Prerequisites

  • Currently MyEnv works on Linux (other UNIXes may work but are not tested).

  • MyEnv works best with recent Debian, Ubuntu or Rocky Linux distributions.

  • MyEnv is based on PHP.

  • A dedicated user (typically dba) to run the databases is required. This user must have a shell (bash is tested).

2.3. Download and install MyEnv

FromDual offers you 2 different methods how you can install MyEnv:

We follow the Debian, Ubuntu and Rocky Linux distribution maintenance policies for Long Term Support (LTS) releases.

Note
Other distributions like Red Hat, Oracle Linux, AlmaLinux, CentOS, Fedora and other Debian based distributions may work as well. Please let us know if you experience any problem with those.

2.4. Adding FromDual DEB or RPM repositories

Adding the FromDual DEB or RPM repositories is described here.

2.5. Installation of the MyEnv from our Repository on Debian and Ubuntu

Debian
Ubuntu

Make sure you have added the FromDual DEB repository first. Then you can install the Performance Monitor as follows:

$ sudo apt install myenv

To test if the installation was successful see Testing MyEnv installation.

2.6. Installation of the MyEnv from our Repository on Rocky Linux, Red Hat Linux, Oracle Linux, AlmaLinux, Fedora and CentOS

Rocky Linux
Red Hat
Oracle Linux
AlmaLinux
Fedora
CentOS

Make sure you have added the FromDual RPM repository first. Then you can install the Performance Monitor as follows:

$ sudo dnf install myenv

To test if the installation was successful see Testing MyEnv installation.

2.7. Installation of the MyEnv from a tarball

If you are installing the MyEnv from a tarball some preparation work has to be done beforehand.

2.7.1. Prerequisites

The following packages have to be installed. They may be named differently depending on your distribution:

  • DEB:

$ sudo apt update
$ sudo apt install php-cli php-mysql wget
$ sudo apt install libaio1t64 # for MySQL, new
$ sudo apt install libaio1 # for MySQL, old
$ sudo apt install xz-utils libnuma1 libncurses6   # for MySQL
$ sudo apt install libreadline8t64 libpq5 libicu<??>   # for PostgreSQL
  • RPM:

$ sudo dnf install php-cli php-mysqli php-posix tar wget   # provided by php-mysql and php-process
$ sudo dnf install libaio xz numactl-libs ncurses   # For MySQL
$ sudo dnf install libpq libicu   # For PostgreSQL
  • SuSE:

$ sudo zypper install php-posix php-pcntl php-mysql php-sockets

MyEnv is assumed to run under the user dba. Thus you have to create this user and its group:

$ sudo groupadd --system dba
$ sudo useradd --system --gid dba --home-dir /home/dba --create-home --shell /bin/bash dba
$ sudo passwd dba

Some directories for database socket files and the MyEnv configuration files are needed:

$ sudo mkdir /run/myenv /etc/myenv
$ sudo chown -R dba: /run/myenv /etc/myenv
$ sudo chmod 740 /etc/myenv

2.7.2. Configuration

In the file /etc/php5/cli/php.ini or /etc/php/x.y/cli/php.ini (Debian/Ubuntu) or /etc/php.ini (Rocky Linux), change the following setting:

[PHP]
variables_order = "EGPCS"

2.7.3. Download and installation

MyEnv can be downloaded from the FromDual download page or directly via the command line.

Switch the user:

$ sudo su - dba

and create some more folders in his home directory:

$ mkdir ~/product ~/database ~/download
  • product is the location of the unpacked binaries. This is the location where MyEnv is looking for them by default.

  • download is intended to be used as landing zone for downloads, such as fresh binary tarballs.

  • database usually contains the datadir of the instances (more precisely instancedir).

To install MyEnv you have to untar it. It is assumed to do that in the product directory of the dba user.

To install the MyEnv from a tarball proceed as follows:
$ sudo su - dba
$ VERSION='2.1.1'
$ cd /tmp
$ wget https://support.fromdual.com/admin/download/myenv-${VERSION}.tar.gz
$ cd ~/product
$ tar xf /tmp/myenv-${VERSION}.tar.gz
$ rm -f myenv   # in case of an upgrade
$ ln -s myenv-${VERSION} myenv
$ cp -i ~/product/myenv/tpl/myenv.conf.template /etc/myenv/myenv.conf

2.8. Testing FromDual MyEnv installation

$ ~/product/myenv/bin/showMyEnvVersion.php

2.9. Put MyEnv under Systemd controll

# Become root again
$ sudo cp -i /home/dba/product/myenv/tpl/systemd.myenv.dba.unit.template /etc/systemd/system/myenv.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable myenv.service
Created symlink /etc/systemd/system/myenv → /etc/systemd/system/myenv.service.

$ sudo systemctl status myenv.service
● myenv.service - FromDual Environment for MySQL and MariaDB (myenv)
   Loaded: loaded (/etc/systemd/system/myenv.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: https://www.fromdual.com/myenv-installation-guide

$ sudo systemctl start myenv
$ sudo systemctl status myenv
● myenv.service - FromDual Environment for MySQL and MariaDB (myenv)
   Loaded: loaded (/etc/systemd/system/myenv.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-09-01 09:42:39 CEST; 4s ago
     Docs: https://www.fromdual.com/myenv-installation-guide
  Process: 19532 ExecStartPre=/usr/bin/mkdir -p /run/myenv (code=exited, status=0/SUCCESS)
  Process: 19533 ExecStartPre=/usr/bin/chown mysql: /run/myenv (code=exited, status=0/SUCCESS)
 Main PID: 19534 (myenv_start_sto)
    Tasks: 32 (limit: 4915)
   Memory: 343.7M
   CGroup: /system.slice/myenv.service
           ├─19534 /usr/bin/php -d variables_order=EGPCS /home/dba/product/myenv/bin/myenv_start_stop.php start
           ├─19552 bin/mysqld --defaults-file=/home/dba/database/monitoring/etc/my.cnf --basedir=/home/dba/product/mysql-5.7 --datadir=/home/dba/database/monitoring/data --user=mysql
           ├─19584 sh -c export LC_ALL=C ; /usr/bin/php -d variables_order=EGPCS -f /home/dba/product/myenv-2.0.2/bin/database.php mysql-80 start 2>&1 2>/tmp/my_exec.stderr.19534
           ├─19585 /usr/bin/php -d variables_order=EGPCS -f /home/dba/product/myenv-2.0.2/bin/database.php mysql-80 start
           └─19595 bin/mysqld --defaults-file=/home/dba/database/mysql-80/etc/my.cnf --basedir=/home/dba/product/mysql-8.0 --datadir=/home/dba/database/mysql-80/data --user=mysql

Sep 01 09:42:39 boss systemd[1]: Starting FromDual Environment for MySQL and MariaDB (myenv)...
Sep 01 09:42:39 boss systemd[1]: Started FromDual Environment for MySQL and MariaDB (myenv).

$ sudo journalctl -xeu myenv
...

$ sudo tail /home/dba/product/myenv/log/myenv_start_stop.log -n 20
2025-09-01 09:42:39 Starting myenv_start_stop
2025-09-01 09:42:39 Starting instances: monitoring mysql-80 dwh mysql-84 mariadb-114 mariadb-118 mysql-8019
2025-09-01 09:42:39   Starting instance: monitoring
2025-09-01 09:42:42   Starting instance: mysql-80
2025-09-01 09:42:54   Starting instance: dwh
2025-09-01 09:42:57   Starting instance: mysql-84
2025-09-01 09:43:00   Starting instance: mariadb-114
2025-09-01 09:43:03   Starting instance: mariadb-118
2025-09-01 09:43:10   Starting instance: mysql-8019
2025-09-01 09:43:18 Finished myenv_start_stop (rc=0).

2.10. Upgrading MyEnv

Upgrading MyEnv is very easy. You can proceed as follows if you want to upgrade to a newer version of MyEnv:

$ su - dba
$ cd ~/download
$ VERSION='2.1.1'
$ wget https://support.fromdual.com/admin/download/myenv-${VERSION}.tar.gz
$ cd ~/product
$ tar xf ../download/myenv-${VERSION}.tar.gz
$ unlink myenv
$ ln -s myenv-${VERSION} myenv

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

Please also check the Release notes for specific problems.

2.10.1. Upgrading plug-ins

If you are using plug-ins for showMyEnvStatus create all the links in the new directory structure:

$ cd ${HOME}/product/myenv
$ ln -s ../../utl/oem_agent.php plg/showMyEnvStatus/

2.10.2. Upgrade to MyEnv v3.0.0

It is recommended to upgrade to MyEnv v2.1.0 or v2.1.1 first before upgrading to v3.0.0. This is the only tested upgrade path. Others may work or not.

  • File permission checks are more strict in v3.0.0. Thus you will get the following warning:

user@machine:~$ sudo -i -u mysql
[sudo] password for user:
WARNING: File permission of configuration file /etc/myenv/myenv.conf is wrong!
         Please change with chmod 0640 /etc/myenv/myenv.conf (rc=596)
ERROR: rc=596
ret=84

Up       : prod3 (11.8)

Down     :

prod3 (*:3306) : crm dbstat download dwh erp focmm mantis mpm staging zabbix

Please execute the following command to make the warning go away:

$ chmod 0640 /etc/myenv/myenv.conf
  • The Systemd unit file has changed in the templates (tpl/systemd.myenv.*.unit.template). This will rise the following warning:

File /etc/systemd/system/myenv.service is old and possibly not up to date. (rc=519)
Check the differences an fix it carefully with the following command:

shell> sudo cp /etc/systemd/system/myenv.service /etc/systemd/system/myenv.service.orig
shell> sudo cp /home/mysql/product/myenv/tpl/systemd.myenv.dba.unit.template /etc/systemd/system/myenv.service
shell> sudo systemctl daemon-reload

Instead of just copying the unit file you should first diff the files and probably adapt your unit file instead of overwriting it.

$ diff /home/mysql/product/myenv/tpl/systemd.myenv.mysql.unit.template /etc/systemd/system/myenv.service
# Adapt the file: /etc/systemd/system/myenv.service then:
$ sudo systemctl daemon-reload

As a workaround, to make the message go away you can also copy your unit file into the tpl directory:

$ cp /home/mysql/product/myenv/tpl/systemd.myenv.mysql.unit.template /home/mysql/product/myenv/tpl/systemd.myenv.mysql.unit.template.orig
$ cp /etc/systemd/system/myenv.service /home/mysql/product/myenv/tpl/systemd.myenv.mysql.unit.template

2.11. Un-install MyEnv

To un-install MyEnv again just remove the myenv section from your .bash_profile and the ~/product/myenv link:

$ cd ~/product
$ sudo rm -rf myenv-x.y myenv /etc/init.d/myenv /etc/myenv
$ sudo rm /etc/systemd/system/myenv.service
$ sudo systemctl daemon-reload

Make sure that the original start/stop script is put back in place and that the my.cnf is at its original location.

3. User Guide

3.1. Technical Overview

…​

3.2. Downloading and installing database binary tarball

Before you start configuring MyEnv and a MyEnv controlled database instance it is recommended to first install the binary tarball of your favourite database MariaDB, MySQL or PostgreSQL:

3.2.1. For MariaDB

mariadb

Go to the MariaDB Downloads page, choose MariaDB Server VersionLinuxArchitectureInit System to choose the release you want to use. And download the tarball to the ~/download directory. Alternatively you can do it also on the command line:

$ su - dba
$ cd ~/download
$ MAVERSION='12.3.1'
$ wget https://archive.mariadb.org//mariadb-${MAVERSION}/bintar-linux-systemd-x86_64/mariadb-${MAVERSION}-linux-systemd-x86_64.tar.gz
$ cd ~/product
$ tar xf ~/download/mariadb-${MAVERSION}-linux-systemd-x86_64.tar.gz
$ ln -s mariadb-${MAVERSION}-linux-systemd-x86_64 mariadb-${MAVERSION}

3.2.2. For MySQL

mysql

Go to the Download MySQL Community Server page and choose Select VersionLinux - GenericOS Version to choose the release you want to use. And download the tarball to the ~/download directory. Alternatively you can do it also on the command line:

$ su - dba
$ cd ~/download
$ MYVERSION='8.4.8'
$ MAJOR=$(echo ${MYVERSION} | cut -d. -f-2)
$ GLIBCVERSION='2.28'
$ wget https://dev.mysql.com/get/Downloads/MySQL-${MAJOR}/mysql-${MYVERSION}-linux-glibc${GLIBCVERSION}-x86_64.tar.xz
$ cd ~/product
$ tar xf ~/download/mysql-${MYVERSION}-linux-glibc${GLIBCVERSION}-x86_64.tar.xz
$ ln -s mysql-${MYVERSION}-linux-glibc${GLIBCVERSION}-x86_64 mysql-${MYVERSION}

On recent Debian (13, trixie) and Ubuntu (24.04 and probably 26.04 as well) distributions we currently have a problem with the AIO library libaio1. This library was renamed to libaio1t64 in the recent releases. So the library is not loaded any more by the mysqld process and thus it fails to start (you can check with ldd mysqld).

We have opened a bug report about this issue at Oracle/MySQL: https://bugs.mysql.com/119954 but our hope is very limited that this issue will be fixed soon.

Luckily we found a workaround:

$ cd /usr/lib/x86_64-linux-gnu
$ ln -s libaio.so.1t64 libaio.so.1

3.2.3. For PostgreSQL

postgresql
Compile PostgreSQL from source and create a binary tarball (.tar.gz)

For PostgreSQL we did not find binary tarballs (download). So we have to create them ourselves. On Debian we had some libicu library issues. So it makes sense to compile PostgreSQL on the right distribution (Ubuntu and Rocky Linux were exchangeable, on Debian we had to copy the 'older' libraries from Ubuntu):

Details
$ VERSION='18.3'
$ cd /tmp
$ wget https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.gz
$ tar xf postgresql-${VERSION}.tar.gz
$ cd postgresql-${VERSION}/
$ ./configure --prefix=/tmp/postgresql-${VERSION}-x86_64
$ make -j 4
$ make install
$ tar -C /tmp -czf /tmp/postgresql-${VERSION}-x86_64.tar.gz postgresql-${VERSION}-x86_64
$ cp /tmp/postgresql-${VERSION}-x86_64.tar.gz ~/download/
Install a PostgreSQL binary tarball (.tar.gz) under MyEnv
$ su - dba
$ VERSION='18.3'
$ cd ~/product
$ tar xf ~/download/postgresql-${VERSION}-x86_64.tar.gz
$ ln -s postgresql-${VERSION}-x86_64 postgresql-${VERSION}

3.3. Configuration of MyEnv

It is recommended to have already database binaries available. See step above.

To configure MyEnv you have 2 possibilities:

  • You can configure MyEnv manually (NOT recommended):

Details
$ sudo echo 'export MYENV_BASE=/home/dba/product/myenv' > /etc/myenv/MYENV_BASE
$ sudo cp -i /home/dba/product/myenv/tpl/myenv.conf.template /etc/myenv/myenv.conf
$ sudo cp -i /home/dba/product/myenv/tpl/variables.conf.template /etc/myenv/variables.conf
$ sudo cp -i /home/dba/product/myenv/tpl/aliases.conf.template /etc/myenv/aliases.conf
$ cat ~/product/myenv/tpl/profile.template >> ~/.bash_profile
  • or you can configure MyEnv by running the MyEnv installer (recommended). The letters in CAPITALS always means default choice when you hit <CR>:

$ ~/product/myenv/bin/installMyEnv.php

Configuration file /etc/myenv/myenv.conf already exists.

Use this, overwrite with Template or Abort (U,t,a): U


No instance exists yet.

An instance is the same as a mariadbd/mysqld/postgres process.

What do you want to do next?
o Add a new instance,
o change an existing instance,
o delete an existing instance,
o save configuration and exit or
o quit without saving

(A/c/d/s/q)? A

You have to enter a new instance name. An instance name can consist of 0-9, a-z, A-Z, - and _.

Examples: test, prod, dev, [mariadbd1] mysqld1 mariadbd-3306 postgresql1

Enter a new instance name: mariadbd1

You have to enter the database type.

Choice: [mysql] or postgresql

Enter database type: mysql

Changing instance mariadbd1:

Set basedir. The basedir is the directory where your MariaDB/MySQL/PostgreSQL binaries are located.
Example:
/home/dba/product/mariadb-12.3.1
/home/dba/product/mariadb-12.3.1-linux-systemd-x86_64
/home/dba/product/mysql-8.4.8
/home/dba/product/mysql-8.4.8-linux-glibc2.28-x86_64
/home/dba/product/postgresql-18.3
/home/dba/product/postgresql-18.3-x86_64

basedir = /home/dba/product/mariadb-12.3.1

/home/dba/product/mariadb-12.3.1 seems to exist and has already some files in it.

Omitting installation of binary tar ball.

Set instancedir. The instancedir is the directory where your MariaDB/MySQL/PostgreSQL data directory (datadir) is located.

Example: /var/lib/mysql/mariadbd1 /opt/mysql/mariadbd1 /usr/local/mysql/mariadbd1 [/home/dba/database/mariadbd1]
instancedir =

Creating directory /home/dba/database/mariadbd1

Set datadir. The datadir is the directory where your MariaDB/MySQL data are located.

Example: /var/lib/mysql /opt/mysql/data /usr/local/mysql/data /home/dba/data/mariadbd1 [/home/dba/database/mariadbd1/data]
datadir =

Creating directory /home/dba/database/mariadbd1/data

Shall I install a MariaDB/MySQL/PostgreSQL instance under /home/dba/database/mariadbd1/data (Y/n)?
Installing MariaDB/MySQL instance. Please be patient, this can take a while...

/home/dba/product/mariadb-12.3.1/scripts/mariadb-install-db --no-defaults  --user=dba --datadir=/home/dba/database/mariadbd1/data --basedir=/home/dba/product/mariadb-12.3.1

Set port.
Example: [3307]
port  =


Set socket.
Example: [/run/myenv/mariadb-3307.sock] /run/myenv/mariadb-mariadbd1.sock /run/myenv/mariadb.sock /run/myenv/mysql-3307.sock /run/myenv/mysql-mariadbd1.sock /run/myenv/mysql.sock
socket  =


Choose location of database configuration file (my.cnf/postgresql.conf):
Example: /etc/my.cnf /etc/mysql/my.cnf /home/dba/database/mariadbd1/data/my-3307.cnf /home/dba/database/mariadbd1/data/my.cnf [/home/dba/database/mariadbd1/etc/my.cnf]
my.cnf  =

INFO: There is no such file /home/dba/database/mariadbd1/etc/my.cnf yet.

Shall I strip comments from the configuration file (Y/n)?
Creating file /home/dba/database/mariadbd1/etc/my.cnf
Link my.cnf to datadir.

Shall mariadbd/mysqld be started with angel process (mariadbd-safe/mysqld_safe) (y/N)?

Shall instance run under cgroups to fences resources (y/N)?

Choose stage of instance mariadbd1:
Possible values: [production] quality testing development
stage  =

The following instances are available:

mariadbd1

An instance is the same as a mariadbd/mysqld/postgres process.

What do you want to do next?
o Add a new instance,
o change an existing instance,
o delete an existing instance,
o save configuration and exit or
o quit without saving

(a/c/d/S/q)? S


Writing the configuration file /etc/myenv/myenv.conf...
Rename /etc/myenv/myenv.conf to /etc/myenv/myenv.conf.2026-02-28-20-09-17
Write /etc/myenv/myenv.conf
Do you want to add the following code to your ~/.bash_profile file?

source /etc/myenv/MYENV_BASE
MYENV_PWD=$(pwd)
cd $MYENV_BASE/bin
source myenv.profile
cd $MYENV_BASE;
$MYENV_BASE/bin/showMyEnvStatus.php;
cd - > /dev/null
cd $MYENV_PWD

(Y/n)?

Writing /etc/myenv/MYENV_BASE

Now source your profile as follows:
shell> source ~/.bash_profile

The README gives some hints how to continue...

$ source ~/.bash_profile

Up       :

Down     : mariadbd1 (12.3.1)

mariadbd1 [*:3307 ] : test

After each MyEnv installation or configuration operation you should run:

$ source ~/.bash_profile

to refresh the environment settings.

3.3.1. Troubleshooting: Problems with libraries

When installing binary tarballs on a system you may experience problems with libraries. Here some examples:

mariadbd: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
initdb: error while loading shared libraries: libicuuc.so.74: cannot open shared object file: No such file or directory
postgres: error while loading shared libraries: libicui18n.so.74: cannot open shared object file: No such file or directory

This problems/errors can have various reasons:

  1. The library is not installed yet. Because binary tarballs cannot enforce library dependencies your are responsible on your own. So please install the required libraries first as described in the documentation above.

  2. The binary tarballs are created on a specific Linux distribution where other libraries may exist or exist in a different version. This could be another reason for this error. To find our if all library requirements are met you can run the following command:

$ ldd mariadbd
       ...
       libcrypt.so.1 => not found

If this is the case you have 2 options:

  • Copy the missing library from the distribution where the binary tarball was compiled to your system and link it accordingly.

  • Compile the database binaries on the wanted platform and create a binary tarball yourself. Description further up (for PostgreSQL, similar for MariaDB and MySQL).

3.4. Put a database under MyEnv control

Run the MyEnv install script ~/product/myenv/bin/installMyEnv and choose the option "a" (add instance) then follow the instructions.

Or add a section similar to the following example to the MyEnv configuration file /etc/myenv/myenv.conf:

#
# /etc/myenv/myenv.conf
#

[test]

start                = yes
stop                 = yes
hideschema           = mysql,performance_schema,lost+found,sys
type                 = mysqld
basedir              = /home/dba/product/mysql-5.7
instancedir          = /home/dba/database/myenv_test
datadir              = /home/dba/database/myenv_test/data
user                 = mysql
port                 = 3306
socket               = /run/myenv/mysql-3306.sock
my.cnf               = /home/dba/database/myenv_test/etc/my.cnf
angel                = no
cgroups              = no
stage                = testing

3.5. How MyEnv works

It is always recommended to work as user mysql for starting, stopping and doing maintenance work. Otherwise you run into conflicts with permissions on files, etc.

When you login as user mysql you will get the current status of your environment (if MyEnv is installed and configured correctly):

    dba@master:~ [prodcms, 3308]> u

    Up       : mysql-8421 (5.7.21) prodcms (10.2)

    Down     : mysql-84 (5.7) mariadb-103 (10.3.8) mysql-4030 (4.0.30)
               mysql-4125 (4.1.25) mariadb-55 (5.5) galera-57-a (5.7)
               galera-57-b (5.7) galera-57-c (5.7)

    mysql-8421             (*:3311 ) : cacti
    mysql-84               (*:3310 ) : cluster_test test01 test02 test03
                                       test04
    mariadb-103            (*:3314 ) : typo3
    mysql-4030             (*:3309 ) : test
    mysql-4125             (*:3313 ) : test foodmart
    mariadb-55             (*:3307 ) : drupal7
    prodcms                (*:3308 ) : drupal8
    mariadb-55             (*:3312 ) : magento oxid
    galera-57-a (192.168.57.1:3306 ) : hybris
    galera-57-b (192.168.57.2:3306 ) : hybris
    galera-57-c (192.168.57.3:3306 ) : hybris

    dba@master:~ [prodcms, 3308]>

3.6. Functionality

The most important command in MyEnv are:

<instance> : Switches to the environment for this instance. For example:
             $ mariadb-103
u or up    : Lists, which releases are available, which instances are up and
             down and which instance contains which database. For example:
             $ u
start      : Starts the actual or a specific instance. For example:
             $ start
             or
             $ start mysql-805
stop       : Stops the actual instance or a specific instance. For example:
             $ stop
             or
             $ stop mariadb-10212
restart    : restarts the actual or a specific instance. For example:
             $ restart
             or
             $ restart mysql-8421
bootstrap  : bootstraps a Galera node.
V          : print the current MyEnv version
cdb        : cd to the binlogdir of this instance.
cdd        : cd to the datadir of this instance.
cde        : cd to the etcdir of this instance.
cdh        : cd to the basedir of this instance.
cdi        : cd to the instancedir of this instance.
cdl        : cd to the logdir of this instance.
cdm        : cd to the myenv-directory.
cdt        : cd to the tmpdir of this instance.
cd a b     : cd to a directory with the name where a is substituted by b.
             For example:
             $ pwd /var/lib/mysql1
             $ cd 1 2
             $ pwd /var/lib/mysql2
ll         : ls -l
la         : ls -la
mv         : mv -i
rm         : rm -i

Some examples:

    dba@chef:~ [mariadb-123, 3318]> u

    Up       : mariadb-118 (11.8) mysql-84 (8.4)

    Down     : monitoring (8.4) dwh (8.4) mariadb-123 (12.3)

    monitoring               (*:3319)  : mem mem__advisor_text mem__advisors mem__bean_config mem__config mem__enterprise
                                         mem__events mem__instruments mem__instruments_config mem__inventory mem__quan sys zabbix
    mariadb-118              (*:3312 ) : test
    dwh                      (*:3325 ) : cms crm datamart download erp focmm foodmart mpm shop staging tellmatic test
    mariadb-123              (*:3318 ) : foodmart test world
    mysql-84                 (*:3320 ) : FlughafenDB test test2

    dba@chef:~ [mariadb-123, 3318]> dwh
    dba@chef:~ [dwh, 3325]>

    dba@chef:~ [dwh, 3325]> start
    . SUCCESS!
    dba@chef:~ [dwh, 3325]> restart
    .. SUCCESS!
    . SUCCESS!
    dba@chef:~ [dwh, 3325]> stop
    .. SUCCESS!

    dba@chef:~ [dwh, 3325]> mariadb-118
    dba@chef:~ [mariadb-118, 3312]> cdm
    dba@chef:~/product/myenv [mariadb-118, 3312]> cdh
    dba@chef:~/product/mariadb-11.8 [mariadb-118, 3312]> cdd
    dba@chef:~/database/mariadb-118/data [mariadb-118, 3312]> cdb
    dba@chef:~/database/mariadb-118/binlog [mariadb-118, 3312]> cde
    dba@chef:~/database/mariadb-118/etc [mariadb-118, 3312]> cdl
    dba@chef:~/database/mariadb-118/log [mariadb-118, 3312]> cd 102 103
    dba@chef:~/database/mariadb-123/log [mariadb-118, 3312]>

MyEnv works with aliases, variables and functions. With the UNIX commands alias, env and declare -F | grep -v '_' you get an overview over the MyEnv functionality.

3.7. Troubleshooting

To enable debugging functionality, use the following command:

$ export MYENV_DEBUG=1

To disable the debugging again, use the following command:

$ unset MYENV_DEBUG

Feedback is always welcome! In case you found a bug or you have a feature request, please report it to the [FromDual bug tracker](https://support.fromdual.com/bugs "FromDual bug tracker") or send us an email.

4. Enterprise Subscription and Support

…​

5. Release Notes

Release notes see here

6. Questions and Answers (Q & A)

Question: How can I set a default instance chosen when I log in?

Answer: In the configuration file /etc/myenv/myenv.conf you can add a default instance in the [default] section as follows:

    #
    # /etc/myenv/myenv.conf
    #

    [default]

    default              = mariadb-123

This instance leads to the following prompt and environment when logged in:

dba@boss:~ [mariadb-123, 3306]>

Question: We were unable to stop an instance through myenv but start is working fine. How can we find the problem?

    [root@ip-172-31-46-213 ~]# su - dba

    Up       : Master (5.7.30) Slave (5.7.30)

    Down     :

    Master (*:3306 ) :
    Slave  (*:3307 ) :

    dba@ip-172-31-46-213:~ [Master, 3306]> stop
    ERROR: Cannot find nor guess PID file (rc=520). Is it possible that the database is already
    stopped? (rc=520)
    ERROR: Stopping instance Master failed (rc=546).

Answer: In all FromDual tools the return code (rc)is unique. So you can easily find where in the code the error happened. In your case it is in lib/MyEnv.inc in the function stopInstance.

In the code we check if PID file is empty. And it is empty if it cannot be found:

  • in my.cnf specified in myenv.conf as variable pid_file

  • under $datadir/mysqld.pid

  • under $datadir/<hostname>.pid

It would be interesting for us if you could tell us where your PID file is located and where it is configured (SHOW GLOBAL VARIABLES LIKE 'pid%';).