Thursday 19 September 2024

Proposal to make MariaDB the default MySQL variant in Ubuntu 25.04

Hi Ubuntu devs,

The MariaDB Server, a fork of MySQL created in response to it being
acquired by Oracle, has been the default MySQL variant in Debian since
2016. Starting from Debian 9 "Stretch" in 2017, MariaDB has been the
only MySQL variant in stable Debian releases. The situation has been
similar in the Fedora and SuSE ecosystems — currently Ubuntu is the
only major Linux distribution that ships Oracle MySQL at all.

I think it is now time for Ubuntu to follow suit and at least make
MariaDB the default in the Ubuntu 25.10 cycle, and potentially remove
MySQL in some later release.

The 25.04 development cycle is not yet open, but I am submitting this
proposal now, as it would be an ideal time to plan and decide ahead,
and execute immediately at the start of the 25.04 dev cycle in early
November.


Benefits
=======

The main benefits listed in order of importance:

The MariaDB Server is more Ubuntu
------------------------------------------------

MariaDB is more compatible with the Ubuntu community values and closer
to the Ubuntu meaning "humanity to others" than Oracle MySQL. All Free
and Open Source Software proponents view MariaDB as a far better
option than Oracle MySQL, which only does code dumps at release to
stay GPL-compliant and has no openness beyond that. MySQL does accept
contributions, but under very strict contributor license terms and
without transparency on what happens with the submission, and their
contributor numbers are very low.

While MariaDB isn't perfect, it does function far better in spirit
than Oracle, thanks to all MariaDB development happening in the open.
This means that anybody can see git commits in real-time, and
participate in all bug tracker, mailing list and chat discussions. To
mention some weaknesses, the reviews often take a long time and the CI
is not consistently green, but at least there are public code reviews
happening and all CI runs are public. This is in sharp contrast to how
Oracle runs MySQL development. Additionally, the MariaDB Server
development is stewarded by the non-profit MariaDB Foundation, with
two dozen sponsors to help guarantee continuity and openness [1].


The MariaDB Server is likely to outlive MySQL
-------------------------------------------------------------

Oracle acquired Sun Microsystems in 2008, and MySQL with it. To avoid
antitrust lawsuits in the EU, Oracle made public commitments to not
kill MySQL, which at the time was considered a competitor to Oracle's
own database. While Oracle did sunset many other projects and thus
made room for a truly open version to live on (e.g. OpenOffice ⇾
LibreOffice, Hudson ⇾ Jenkins), in the case of MySQL, it has kept the
lights on for now. Some argue[2] however that Oracle has been slowly
killing MySQL in the past years by not adding relevant features to its
core GPLv2 edition, but instead putting all new cool things in
Heatwave, their closed source cloud-only offering.

The MariaDB Server, on the other hand, has been steadily adding major
features. MariaDB offers for example the SQL_MODE=oracle mode to ease
migrations away from the Oracle database, something Oracle would never
do in MySQL as it would cannibalize their own main product. Supporting
users to migrate away from Oracle databases is important to advancing
open source adoption in general, and good for all current and future
Ubuntu users.


MariaDB is growing faster than MySQL
----------------------------------------------------

MySQL became the most popular open source database in the advent of
web applications in the late 1990s and in particular as part of the
LAMP stack. For example WordPress, Wikipedia and Facebook were
originally built on MySQL. However, in the past decade MySQL has been
in steady decline based on various data sources such as Google Trends,
Shodan Trends and DB-Engines. These data sources however show that
MariaDB has been steadily growing. The growth of MariaDB is far behind
the growth of PostgreSQL, but nevertheless MariaDB is growing faster
than MySQL.

For several years already, the company behind WordPress, Automattic,
and the Wikimedia Foundation have been using MariaDB extensively and
have also been MariaDB Foundation sponsors. Most Linux distributions
have been shipping only MariaDB for nearly a decade. Ubuntu is one of
the few that has been resisting this trend, and I suggest it to be
changed now.


MariaDB is more stable
-------------------------------

Both MySQL and MariaDB have bugs, and some (albeit a declining number)
of the bugs are identical, as they stem from the old code base that is
still the same for MySQL and MariaDB. However many users have noticed
that MySQL has in recent years had many severe bugs and the quality of
MySQL releases seems to have declined, in particular since MySQL
8.0.29 [3]. The latest MySQL 8.0.38 has such a severe bug that Percona
publicly warns about upgrading to it [4].

The stability of MariaDB is also directly visible in the Debian and
Ubuntu (Launchpad) bug trackers, where MariaDB has 55 and 2 bugs
compared to MySQL (8.0) with 150 and 38 bugs. Both variants are in
wide use and have had roughly the same number of releases, so the
numbers are mostly comparable. MariaDB has been getting stable
security updates on steady cadence since Ubuntu 14.04 in all LTS and
non-LTS versions and, to my recollection, with zero regressions.


MariaDB has more features
------------------------------------

MariaDB 11.7, scheduled to be announced for general availability in
February 2025, will have several features MySQL lacks. Notable
examples are full vector storage and search functionality for
retrieval augmented AI applications, complete year 2038 support,
online schema changes (ALTER TABLE without locking the entire table),
TLS enabled by default with zero-configuration certificate management,
new PARSEC authentication method for improved security and much more.
MySQL seems to be adding most new features to their non-open version,
while the open source version that Ubuntu uses hasn't seen that many
new significant features despite having a more frequent release
cadence now.


MariaDB is faster
-----------------------

Speed has always been a selling point for MySQL/MariaDB compared to
other databases. For every new release of both MySQL and MariaDB, new
features are introduced, and they increase the overhead a bit.
However, MariaDB has a much better ratio of new features vs.
performance penalty, and MySQL has both fewer features and more
performance regressions [5]. Thus, users already on MySQL/MariaDB are
likely to value performance and likely would benefit from the 5-30%
performance improvement if switching to MariaDB (depends on workload).


Switching to MariaDB right now would be the optimal timing
------------------------------------------------------------------------------

Ubuntu 24.10 repositories currently contain MySQL 8.0, which will be
end-of-life in April 2026. Users will be faced with a decision to do
migration work from MySQL 8.0 to either a new major MySQL version or
to MariaDB. Due to MySQL aggressively deprecating features/SQL syntax,
upgrading to a new future MySQL version is likely going to require
extra work. Assuming MariaDB maintains its excellent backwards
compatibility track-record, upgrades to MariaDB from MySQL do not
require much application changes and is likely less disruptive to the
majority of users.

Introducing MariaDB as the new default in Ubuntu 25.04 would ensure
that when Ubuntu 26.04 comes out, the migration path from MySQL 8.0 to
a future MariaDB version is as smooth as possible. This would also
help minimize the number of users who would run into issues upgrading
to MySQL 8.4 or 9.0 meanwhile.


Potential downsides and risks
=======================

As stated above, MariaDB has been the default and only MySQL variant
in Debian for many years. All packages in Debian have thus been proven
to be fully MariaDB compatible for all practical purposes. No major
downside is to be expected, but any change has the potential to cause
disruptions and should be planned well ahead.


Unexpected Ubuntu-only MySQL dependencies
---------------------------------------------------------------

Changing the default MySQL variant from Oracle MySQL to MariaDB in
Ubuntu might lead to some unexpected breakage if Ubuntu has some
customizations regarding MySQL that are not present in Debian.

To my knowledge there aren't any. Running `apt rdepends mysql*` on an
Ubuntu 24.10 host shows that the only packages that depend on
"mysql-server" specifically are "lyricue", which does not exist in
Debian at all, and "mylvmbackup", which hasn't had any new upstream
releases in a decade. All other hundreds of applications that depend
on MySQL depend on one of the `default-mysql-*` metapackages.

Currently in Ubuntu, these `default-mysql-*` metapackages depend on
the actual MySQL packages. In Debian all the `default-mysql-*`
packages depend on equivalent MariaDB packages. Aligning Ubuntu with
Debian in this regard should go smoothly. All new installations would
start using MariaDB automatically, unless users specifically opt to
use MySQL.


Upgrade issues
---------------------

Changing the default MySQL variant by making the `default-mysql-*`
packages depend on equivalent MariaDB packages will not affect
existing systems and they will continue to run the current MySQL
server they already have.

If a host is running Ubuntu 16.04 or 18.04 with MySQL 5.7 a user could
choose to upgrade directly to MariaDB by simply issuing `apt install
mariadb-server`.

If a host is running Ubuntu 20.04 or newer and has MySQL 8.0, the
in-place upgrade to MariaDB is not possible with a single apt command.
Those users could however be instructed to do a logical dump as a SQL
file with the mysqldump tool, and uninstall MySQL 8.0, install the
latest MariaDB and import the SQL file.

If users do nothing, they would stay on MySQL 8.0 and not have to
consider anything until MySQL 8.0 is end-of-life in April 2026. At
that point users could do the manual upgrade via dump-and-restore to
MariaDB.

Note that while MySQL to MySQL upgrades seem smaller in name than
MySQL to MariaDB upgrades, newer MySQL versions have deprecated a
bunch of features and SQL syntax. Thus, upgrades to new MySQL versions
may require more application changes to be done than simply upgrading
to MariaDB, which so far has an excellent track-record of backwards
compatibility.

There are configuration options that are incompatible between MySQL
and MariaDB. There are ongoing efforts to provide a migration tool
[6]. With more user feedback, this process can be better polished for
Ubuntu 26.04 LTS.


Cross-host compatibility
-------------------------------

Users who have multiple Ubuntu hosts running MySQL servers and
applications using them could in theory face some issues. For example,
when an application server is upgraded to use the MariaDB client while
the database server continues to run a MySQL server. However, the
MySQL wire protocol has not had any changes in decades and thus the
MySQL and MariaDB client libraries and client binaries are fully
interoperable: one can use a MariaDB client to connect to a MySQL
database and vice versa.

The exception to this is any client using the MySQL X protocol. That
is not supported in MariaDB. Those users can however choose to
continue using MySQL. This proposal is not suggesting removing MySQL
from Ubuntu, but simply to make MariaDB the default for a better
future path.

Another consideration is connector libraries, for example for Python
or Java. Due to the protocol compatibility and shared background, most
MySQL connectors are compatible with MariaDB. There are some
incompatibilities in package names in the MariaDB Python connector,
but these can be worked around. Thanks to having had MariaDB as
default in Debian for several years, the remaining issues are
marginal, but not zero.

A third consideration is replication setups. Ubuntu does not include
any replication automation, so all replication setups are managed
manually or by 3rd party automation software. Users would need to be
instructed to upgrade all replicas first, as MySQL and MariaDB in
general are designed to allow replicas to connect to old sources.
After upgrading the replica, users could then promote it to be the
primary source instance, and shut down the old primary to complete the
upgrade process.

While there are some known edge cases when upgrades from MySQL to
MariaDB do not fully work, they are in practice rare. Considering that
all of Debian upgraded smoothly to MariaDB, and that ever since
MariaDB has been steadily adding features that smoothen the migration
path, the upgrade from MySQL to MariaDB should for most users work
flawlessly.


Canonical product impact
----------------------------------

As Canonical is the main sponsor of Ubuntu, the change needs to also
have some consideration for Canonical's business needs. Currently
Canonical advertises MySQL at https://canonical.com/data/mysql but
there is no https://canonical.com/data/mariadb, and Canonical's
automation offering https://charmhub.io/mysql seems to be focused on
MySQL. Kubernetes operators, OpenStack modules and alike exist for
MariaDB, so it is not a technical limitation, but some effort would be
needed to productize MariaDB automation.


Users may need education about the change
-----------------------------------------------------------

There might still be many users who have not heard about MariaDB and
do not know that their current app using MySQL as the backend can
actually run equally well (and in some cases better and faster) on
MariaDB. This can however be mitigated by explaining this in release
notes and in documentation, like has been done in other migrations
(e.g. OpenOffice to LibreOffice, or Oracle Java to OpenJDK).

Small pun: The fact that Ubuntu 24.10 is code name "Oracular" will
make it easier for users to remember it was the last Ubuntu version
that defaulted to Oracle MySQL.


Alternative considerations
====================

While I propose MariaDB Server as the best option, for a holistic
assessment readers should also consider alternative solutions or
mitigations to the problems faced by Oracle MySQL.


Keep MySQL, but demand more openness
---------------------------------------------------------

If the Ubuntu community wants to stick to MySQL, but make it less
risky, Ubuntu should seek ways to promote or protect the openness of
MySQL which is currently nearly non-existent. Ubuntu could perhaps use
its large community to persuade MySQL to publish git commits in
real-time and allow participation in the MySQL development, and the
Ubuntu community could promote every last bit of independent MySQL
community activity that still exists (e.g. promote
https://planet.oursqlcommunity.org/).


Percona Server
---------------------------------------------------------

If the Ubuntu community wakes up to the situation with Oracle MySQL,
but does for some reason not want to switch to MariaDB, another
alternative would be to collaborate with Percona. Ubuntu could
consider offering the Percona Server, which is a fork of MySQL that
follows Oracle more closely, but with added stability and more
features. To illustrate the situation with one example, the audit
plugin that Oracle MySQL only offers in their closed-source edition is
available as open source both in the MariaDB Server and Percona
Server. There is however added risk about the unknown capability of
Percona Server truly maintaining a proper fork, given the age,
complexity, depth and breadth of MySQL as a project.


References
=========

[1] https://mariadb.org/
[2] https://www.percona.com/blog/is-oracle-finally-killing-mysql/
[3] https://jfg-mysql.blogspot.com/2023/11/thoughts-on-october-2023-mysql-releases.html
[4] https://www.percona.com/blog/do-not-upgrade-to-any-version-of-mysql-after-8-0-37/,
https://www.percona.com/blog/mysql-8-0-vs-5-7-are-the-newer-versions-more-problematic/
[5] https://smalldatum.blogspot.com/2024/04/sysbench-on-less-small-server-mariadb.html
[6] https://github.com/MariaDB/server/pull/2976


Package trackers
=============
https://tracker.debian.org/pkg/mariadb
https://launchpad.net/ubuntu/+source/mariadb

https://tracker.debian.org/pkg/mysql-8.0
https://launchpad.net/ubuntu/+source/mysql-8.0

https://tracker.debian.org/pkg/mysql-defaults
https://launchpad.net/ubuntu/+source/mysql-defaults


Technical details about MariaDB release policies and testing
=============================================

The MariaDB yearly LTS model in February provides the opportunity for
a MariaDB LTS release to correspond to the LTS cycle of Ubuntu. The
to-be-LTS version should be available as a release candidate in
November 2025 at the start of the Ubuntu 26.04 LTS dev cycle:
https://mariadb.com/kb/en/mariadb-release-model/

The upstream MariaDB developers test against the architectures of
amd64, arm64, s390x and ppc64le against real hardware of Ubuntu LTS
releases well in advance to their release:
https://buildbot.mariadb.org/#/grid?branch=11.4

MariaDB is well tested on Ubuntu already, thanks to the official
Docker container images being built on the latest Ubuntu LTS tag,
which has well over a billion total image pulls:
https://hub.docker.com/_/mariadb

Disclaimer
========
I am the maintainer for MariaDB in both Debian and Ubuntu, and
distrust and detest Oracle as a company, so I am naturally biased
towards MariaDB. I am however striving to represent both balanced pros
and cons in this proposal and including references.

--
ubuntu-devel mailing list
ubuntu-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel