Skip to content
Musiker15
  • Home
  • News
  • FAQ
  • Community
GitHub
Musiker15

Tutorials & Guides

Personal website of Moritz Kohm — tutorials, guides and background info on Linux/Debian, server administration and self-hosting.

Content

  • Tutorials
  • News
  • FAQ

About

  • About Musiker15
  • Community
  • MSK Scripts

Socials

  • Discord
  • GitHub Musiker15
  • GitHub MSK Scripts

Legal

  • Imprint
  • Privacy

© 2026 Moritz Kohm

DiscordGitHub
  • PC Hardware
  • Debian Tutorials
    • Upgrade from Debian 10 to Debian 11
    • Apache 2, PHP 8, MariaDB and phpMyAdmin
    • MariaDB upgrade on Debian / Ubuntu
    • Certbot — Let's Encrypt (free SSL certificates)
    • TeamSpeak 3 Server
    • Sinusbot
    • pgAdmin 4 — Setup Runbook
  1. Home
  2. Tutorials
  3. Debian Tutorials
  4. MariaDB upgrade on Debian / Ubuntu

MariaDB upgrade on Debian / Ubuntu

Major release upgrade from MariaDB 10 to 11 without data loss.

Edit this page

During a MariaDB upgrade from, say, version 10 to version 11, all existing databases are preserved. So there's no data loss — everything works exactly the same after the upgrade as before.

I still recommend creating a full backup! I take no responsibility if something goes wrong.

First, let's check which MariaDB version we currently have installed:

mysql
status
exit

Under Server Version we can see which MariaDB version is currently installed. In this case we assume version 10.X, so it should say something like Server Version: 10.5.21-MariaDB-XXXXX.

To perform the upgrade, we first have to stop the MariaDB server and then, just to be safe, create backups:

service mysql stop
cp -R /etc/mysql/ /etc/mysql-backup
cp -R /var/lib/mysql /var/lib/mysql-backup

We've now stopped the MariaDB server and created backups of the files. Next, we need to add the new repository to the sources.list:

curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash

Next we have to remove the old MariaDB server so we can download the new version:

apt remove 'mariadb-*'
apt install mariadb-server

The mariadb-* must be in quotes, otherwise the shell will try to expand the * against files in the current directory before apt ever sees it.

Afterwards we should check whether the MariaDB server has started:

mysql

If we get an error here, we start the MariaDB server manually and check whether the new version was installed:

service mysql start
status
exit

After a major upgrade, the system tables have to be adapted to the new version. This is done by mariadb-upgrade (on older versions mysql_upgrade):

mariadb-upgrade

mariadb-upgrade is mandatory after a version jump — it checks and updates the system tables. Without this step you may run into unexpected errors after the upgrade.

In rare cases there are a few minor issues after the installation, e.g. when trying to log in via phpMyAdmin. Such an error might look like this:

error #1231 – Variable 'lc_messages' can't be set to the value of de_DE

In this case it could be that an outdated path is still set in the configuration. To fix it, we simply open /etc/mysql/mariadb.conf.d/50-server.cnf and change the path:

lc-messages-dir = /usr/share/mariadb/german
lc-messages     = de_DE

Now we just restart the MySQL server and everything should work flawlessly again. Once we've tested that everything really works correctly and all previously created databases still work, we can delete the backups we created earlier:

rm -r /etc/mysql-backup
rm -r /var/lib/mysql-backup

DONE