This article is about managing many different installed MariaDB versions and running them one at a time. This is useful when doing benchmarking, testing, or for when developing different MariaDB versions.
This is most easily done using the tar files from downloads.askmonty.org.
If MySQL/MariaDB is already installed and running, you have two options:
~/.my.cnf
file. /etc/rc.d/mysql stop
or mysqladmin shutdown
. Note that you don't have to uninstall or otherwise remove MySQL!
Here is a short description of how to generate a tar file from a source distribution. If you have downloaded a binary tar file, you can skip this section.
The steps to create a binary tar file are:
/usr/local/src/mariadb-5.#
. You will then be left with a tar file named something like: mariadb-5.3.2-MariaDB-beta-linux-x86_64.tar.gz
Install the binary tar files under /usr/local/
with the following directory names (one for each MariaDB version you want to use):
mariadb-5.1
mariadb-5.2
mariadb-5.3
mariadb-5.5
mariadb-10.0
The above assumes you are just testing major versions of MariaDB. If you are testing specific versions, use directory names like mariadb-5.3.2
With the directories in place, create a sym-link named mariadb
which points at the mariadb-XXX
directory you are currently testing. When you want to switch to testing a different version, just update the sym-link.
Example:
cd /usr/local tar xfz /tmp/mariadb-5.3.2-MariaDB-beta-linux-x86_64.tar.gz mv -vi mariadb-5.3.2-MariaDB-beta-linux-x86_64 mariadb-5.3 ln -vs mariadb-5.3 mariadb
When setting up the data directory, you have the option of either using a shared database directory or creating a unique database directory for each server version. For testing, a common directory is probably easiest. Note that you can only have one mysqld
server running against one data directory.
The steps are:
mysql
system user if you don't have it already! (On Linux you do it with the useradd
command). mariadb-data
in the example below) or add a symlink to a directory which is in some other place. mysql
permission tables with mysql_install_db
cd /usr/local/ mkdir mariadb-data cd mariadb ./bin/mysql_install_db --no-defaults --datadir=/usr/local/mariadb-data chown -R mysql mariadb-data mariadb-data/*
The reason to use --no-defaults
is to ensure that we don't inherit incorrect options from some old my.cnf.
To create a different data
directories for each installation:
cd mariadb ./scripts/mysql_install_db --no-defaults chown -R mysql mariadb-data mariadb-data/*
This will create a directory data
inside the current directory.
If you want to use another disk you should do:
cd mariadb ln -s path-to-empty-directory-for-data data ./scripts/mysql_install_db --no-defaults --datadir=./data chown -R mysql mariadb-data mariadb-data/*
The normal steps are:
rm mariadb ln -s mariadb-5.# mariadb cd mariadb ./bin/mysqld_safe --no-defaults --datadir=/usr/local/mariadb-data &
If you are going to start/stop MariaDB a lot of times, you should create a ~/.my.cnf
file for the common options you are using.
The following example shows how to use a non-standard TCP-port and socket (to not interfere with a main MySQL/MariaDB server) and how to setup different options for each main server:
[client-server] socket=/tmp/mysql.sock port=3306 [mysqld] datadir=/usr/local/mariadb-data [mariadb-5.2] # Options for MariaDB 5.2 [mariadb-5.3] # Options for MariaDB 5.3
If you create an ~/.my.cnf
file, you should start mysqld
with --defaults-file=~/.my.cnf
instead of --no-defaults
in the examples above.
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/switching-between-different-installed-mariadb-versions/