2

Something I've seen stump users (including myself) is that Apt won't allow both MySQL and MariaDB to be installed. For instance, here's a nearly 3-year-old AskUbuntu question on the topic, still unanswered.

As a concrete description of the problem, consider Ubuntu 22.04. If I have MySQL installed using Apt, and I then attempt to install the MariaDB package, Apt will demand the removal of MySQL:

# MySQL 8.0 is installed:
$ apt-cache policy mysql-server-8.0 
mysql-server-8.0:
  Installed: 8.0.30-0ubuntu0.22.04.1
  Candidate: 8.0.30-0ubuntu0.22.04.1
  ...

MariaDB 10.6 is not installed:

$ apt-cache policy mariadb-server-10.6 mariadb-server-10.6: Installed: (none) Candidate: 1:10.6.7-2ubuntu1.1 ...

Attempt to install MariaDB 10.6:

$ sudo apt install mariadb-server-10.6 ... The following additional packages will be installed: galera-4 gawk libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libsigsegv2 libterm-readkey-perl mariadb-client-10.6 mariadb-client-core-10.6 mariadb-server-core-10.6 ...

MySQL packages are removed:

The following packages will be REMOVED: mysql-client-8.0 mysql-client-core-8.0 mysql-server mysql-server-8.0 mysql-server-core-8.0 ...

I've never heard anyone give a good reason for this. MySQL and MariaDB are quite similar, but that doesn't automatically preclude them from co-existing. In fact, multiple versions of MySQL itself can co-exist on the same machine, as explained by MySQL. And as explained by MariaDB, there's no reason one of those multiple versions can't be an instance of MariaDB.

So if there's no fundamental reason I can't have MySQL and MariaDB installed at the same time, why does Apt insist on treating these as mutually exclusive?

1 Answers1

5

You can have multiple MySQLs but only ONE installed using apt. For installing through apt MariaDB is the same as a MySQL install: MariaDB is a drop-in replacement and the 2 use the same library names and files (both in /var/lib/mysql and /etc/mysql/my.conf). Maybe in the future this might change.

But like you can install more versions MySQL in for instance /opt and even have those run at the same time using another port you can also add more than 1 MariaDB to all those MySQL installs in /opt and using its own port. Or install more than one using the same port having only 1 active at a time.

sotirov
  • 4,379
Rinzwind
  • 309,379