MariaDB 10.2+ on Debian 9
Debian 9 has MariaDB locked down to 10.1, plus security patches from 10.2 and later. But anything looking still thinks it's 10.1, which for things like NextCloud is a pain. They haven't quite made it outright rejecting such an old DB, but there are quite a lot of warnings about it.
Thankfully, there are repos available for pretty much every distribution to be able to install even up to the latest stable branch directly from the MariaDB Foundation.
Make sure you Add signing key to apt without mass deps.
Next, add a custom sources file as /etc/apt/sources.list.d/mariadb.list:
# MariaDB 10.5 repository list - created 2021-06-25 03:19 UTC # http://downloads.mariadb.org/mariadb/repositories/ deb [arch=amd64,arm64,i386,ppc64el] https://mariadb.mirror.digitalpacific.com.au/repo/10.5/debian stretch main deb-src https://mariadb.mirror.digitalpacific.com.au/repo/10.5/debian stretch main
(This can be done with a apt-repository command, but it wants more dependencies installed to simply write a text file to the sources directory)
Will probably also need to install apt-get install apt-transport-https
Now can just run
apt-get update apt-get install mariadb-server
For the latest versions and other distros, head of the to MariaDB Foundation downloads page. Here's a link that's pre-filled to Debian + MariaDB 10.5:
https://downloads.mariadb.org/mariadb/repositories/#distro=Debian&distro_release=stretch--stretch&version=10.5