Running Multiple Copies of MariaDB
The main problem in having many MariaDB instances running on the same computer is that you will get conflicts between port and sockets.
This page describes how to manually edit the configuration file to have multiple instances of MariaDB (and possibly MySQL or Percona Server). There are however easier solutions to achieve this goal:
- MySQL Sandbox
- Starting multiple Docker containers.
Configuration editing
The minimal configuration to avoid conflicts between instances is the following:
[client] # TCP port to use to connect to mysqld server port=3306 # Socket to use to connect to mysqld server socket=/tmp/mysql.sock [mariadb] # TCP port to make available for clients port=3306 # Socket to make available for clients socket=/tmp/mysql.sock # Where MariaDB should store all its data datadir=/usr/local/mysql/data
The above are the default values. Change them to some unique values for your installation.
The above should be enough to get mysqld
to start and for clients like mysql
to connect to it. Documentation for other options can be found here.
To check what values mysqld
is using, you can do:
mysqld --print-defaults
To list the default values, check the end of:
mysqld --help --verbose
If your problem is that mysqld
reads options from system my.cnf files (like /etc/my.cnf) you can force it to only read one specific configuration file:
mysqld --defaults-file=~/.my.cnf