mysqld_multi lets you run two MariaDB server instances on one host without mixing up which process you are touching. You will check that their option groups are visible, start them selectively, inspect their status, and stop them cleanly. Allow 30 to 60 minutes if the data directories already exist and are initialised. This guide does not initialise a database or overwrite an existing one.
The installed command is MariaDB 10.11.14 from the mariadb-server package version 1:10.11.14-0ubuntu0.24.04.1. On this system, mysqld_multi resolves to mariadbd-multi. The local manual is dated 15 May 2020, so the installed binary is the authority for the examples below.
Run these read-only checks as your normal account. They do not start or stop a server:
$ command -v mysqld_multi
/usr/bin/mysqld_multi
$ readlink -f /usr/bin/mysqld_multi
/usr/bin/mariadbd-multi
$ mysqld_multi --version
WARNING: Log file disabled. Maybe directory or file isn't writable?
mysqld_multi version 3.0 by Jani Tolonen
The warning is about the default log destination. Use --no-log while checking a configuration so diagnostics go to standard output. In this guide, group numbers 2 and 3 identify the two instances. They are labels, not ports, and they do not need to be consecutive.
Checkpoint: Record the real data directories you intend to use. They must be different, and each must already be usable by the Unix account that will run its MariaDB server.
Use an option file that only this workflow will read. The exact path below is a placeholder; choose a location with permissions appropriate to your deployment. Creating or changing a production option file is a service-affecting action, so take a backup first and review every path before saving it.
[mysqld_multi]
mysqld = /usr/bin/mariadbd-safe
mysqladmin = /usr/bin/mariadb-admin
user = multi_admin
password = REPLACE_WITH_THE_SAME_SHUTDOWN_PASSWORD
[mysqld2]
socket = /run/mysqld/mariadb-2.sock
port = 3307
pid-file = /run/mysqld/mariadb-2.pid
datadir = /var/lib/mysql-instance-2
[mysqld3]
socket = /run/mysqld/mariadb-3.sock
port = 3308
pid-file = /run/mysqld/mariadb-3.pid
datadir = /var/lib/mysql-instance-3
Replace every REPLACE_WITH_... value and every example path. Each instance needs its own Unix socket, TCP port, data directory and, especially when using mariadbd-safe, process ID file. A shared data directory can corrupt data or create synchronisation problems; it is not a harmless way to obtain more performance.
The [mysqld_multi] group configures the manager. Each [mysqldN] group passes server options to that numbered instance. The account named by user and password is a MariaDB account used by mariadb-admin to stop servers. Create the same account on each instance with only the SHUTDOWN privilege, and make sure its host part permits connections from the machine running mysqld_multi. Do not put a real password in a world-readable file.
When you use user inside an instance group to change the Unix account running MariaDB, the manual requires mysqld_multi itself to be run as Unix root. That is a separate elevated operation. Prefer preparing ownership and permissions for an unprivileged service account instead of making the manager unnecessarily powerful.
First ask the installed program to print its generated example. This is useful for comparing option names, but it is not a ready-to-run production configuration:
$ mysqld_multi --no-log --example | sed -n '1,80p'
# This is an example of a my.cnf file for mysqld_multi.
# Usually this file is located in home dir ~/.my.cnf or /my.cnf
# ...
Now point the manager at your own file and request a report. Put --defaults-file before the operation, as required by the option-file convention. The file named here is the file you reviewed in the previous step.
$ mysqld_multi --defaults-file=/path/to/multi.cnf --no-log report 2,3
mysqld_multi log file version 3.0; run: Fri Sep 25 05:11:49 2026
Reporting MariaDB servers
MariaDB server from group: mysqld2 is not running
MariaDB server from group: mysqld3 is not running
The timestamp and the report lines depend on the host. A report of "not running" is expected before the first start. If the command cannot find a group, a binary or a socket, stop here and fix the configuration rather than trying a broader command.
Checkpoint: Confirm that ports 3307 and 3308 are free, both data directories are distinct, and the Unix account can read and write the paths it needs. Checking ownership may require elevated privileges, for example sudo -v followed by your distribution's normal permission checks.
Starting a database is a service change. Schedule it if clients could be affected, and keep the other instance stopped until the first one passes its checks:
$ mysqld_multi --defaults-file=/path/to/multi.cnf --no-log start 2
There may be little or no useful output on success because logging and server startup are handled by the configured programs. Immediately request a report:
$ mysqld_multi --defaults-file=/path/to/multi.cnf --no-log report 2
mysqld_multi log file version 3.0; run: Fri Sep 25 05:11:49 2026
Reporting MariaDB servers
MariaDB server from group: mysqld2 is running
Verify the endpoint with a MariaDB client using the instance's socket or port. Use an account that exists on that instance:
$ mariadb --socket=/run/mysqld/mariadb-2.sock -e 'SELECT @@port, @@datadir;'
+--------+--------------------------+
| @@port | @@datadir |
+--------+--------------------------+
| 3307 | /var/lib/mysql-instance-2 |
+--------+--------------------------+
1 row in set (0.00 sec)
Your client may format the table differently. The useful result is that the connection reaches instance 2 and its reported port and data directory match the group.
Start only group 3, then check both groups together. A comma-separated list has no spaces. A range such as 2-3 is also accepted by the installed command.
$ mysqld_multi --defaults-file=/path/to/multi.cnf --no-log start 3
$ mysqld_multi --defaults-file=/path/to/multi.cnf --no-log report 2,3
mysqld_multi log file version 3.0; run: Fri Sep 25 05:11:49 2026
Reporting MariaDB servers
MariaDB server from group: mysqld2 is running
MariaDB server from group: mysqld3 is running
For a TCP check, use the port explicitly. The --tcp-ip option changes how report and stop connect to the servers; it does not start them on a different port.
$ mysqld_multi --defaults-file=/path/to/multi.cnf --no-log --tcp-ip report 2,3
If a socket is missing, a server may still be alive and reachable through TCP. Check the matching port before treating a socket failure as proof that the process has stopped. Never reuse a socket or port merely because a report looked wrong.
Stopping is service-disrupting. Confirm the group numbers, warn users, and stop one instance or an explicit list:
$ mysqld_multi --defaults-file=/path/to/multi.cnf --no-log stop 3
$ mysqld_multi --defaults-file=/path/to/multi.cnf --no-log report 2,3
MariaDB server from group: mysqld2 is running
MariaDB server from group: mysqld3 is not running
If the normal socket is unavailable, repeat the stop with --tcp-ip and confirm that the configured port is reachable. If stopping still fails, do not delete a PID file or kill a process based only on a guessed number. Inspect the service logs and identify the process and its command line before taking a separate, documented recovery action.
The most common configuration traps are shared data directories, duplicate ports or sockets, a PID file that is reused, a shutdown account missing SHUTDOWN, and whitespace in a group list such as 2, 3. The installed program ignores everything after whitespace in that list, so write 2,3 or 2-3 exactly. If you need a clean rollback, stop the instances, restore the backed-up option file, and start only the groups that still match the restored paths. Do not remove data directories as part of a rollback.
mysqld_multi --version identifies the installed manager and you know that mysqld_multi is the compatibility name for mariadbd-multi.