Blocking ads removes funding from us!
Researching and writing articles takes a lot of time. Operating our infrastructure costs money.
All of this is funded with advertising revenue.
We don't like advertising either - that's why we avoid annoying banners and pop-ups.
Please give us a chance and deactivate your adblocker!
Alternatively, you can support us here voluntarily.

Follow us:


Upgrade from MySQL 5.x to MariaDB 10.x under Debian / Ubuntu - this is how it works!

MariaDB logo
Image: MariaDB
(Post picture: © 2021 MariaDB)

The open source world of MySQL is currently switching more and more to MariaDB. Some users are now faced with the question of how the switch is possible. In this guide we show how a MySQL 5 database can be easily exchanged for MariaDB 10.

A little background: After Oracle announced controversial license changes with MySQL 8, more and more supporters of open source software are withdrawing from the database hirschen. Future versions of MySQL are to be developed “closed” - exactly the opposite of open source. For this reason, for example, the popular Linux distributions Debian and Ubuntu in their current versions also include MariaDB as standard instead of MySQL.

Is the Plesk administration tool running on the server? Then the steps for the upgrade are a little different. Then please work through the following guide:

It's that easy to upgrade from MySQL 5.x to MariaDB 10.x.

  1. Create a backup! the Database tables, at best the entire server, should be backed up before the upgrade, as an upgrade can sometimes go wrong.
  2. So that we can start, MySQL has to be updated to the latest version (5.7), but at least to 5.5. This happens with the usual commands:
    sudo apt-get update
    sudo apt-get upgrade
  3. Check database version - In the best case scenario, MySQL should now run on version 5.7:
    mysql
  4. This command should give the following, similar result:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 2187338
    Server version: 5.7.35-0ubuntu0.21.04.1 (Ubuntu)
  5. Add MariaDB repository - auf dieser seite choose the Debian or Ubuntu version used. Then the commands displayed must be carried out. For example the following for a server with Ubuntu 21.04 ("hirsute") and a desired upgrade to MariaDB 10.7:
    sudo apt-get install software-properties-common dirmngr apt-transport-https
    sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
    sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://mirror.netcologne.de/mariadb/repo/10.7/ubuntu hirsute main'
  6. Shut down the MySQL server (on older systems the service may still be called "mysqld"):
    sudo service mysql stop
  7. If the repository and the key from above have been added successfully, the installation of MariaDB will now be carried out. This will remove the old MySQL packages, that's fine.
    sudo apt update
    sudo apt install mariadb-server
  8. Upgrade the database tables on MariaDB:
    mysql_upgrade
  9. Then check that MariaDB has been installed properly. Run the following command:
    mysql
  10. This should deliver the following, similar result:
    Welcome to the MariaDB monitor. Commands end with ; or \g.
    Your MariaDB connection id is 473
    Server version: 10.7.1-MariaDB-1:10.7.1+maria~hirsute mariadb.org binary distribution
  11. It is now advisable to check whether all services and websites connected to the database can be reached. Normally, all services compatible with MySQL 5.5-5.7 should work with MariaDB 10 as well. This guarantee is no longer given for future versions of MariaDB.

Upgrade from MySQL 8.x to MariaDB 10.x

MariaDB 10.x is a "drop-in" replacement, but only for MySQL versions 5.5 to 5.7. This means that no migration work is necessary afterwards. Future versions of MySQL and MariaDB will differ technically in some points and will no longer be easily replaceable. So if you have already updated to MySQL 8, you have to back up all database tables manually and migrate them to MariaDB. Unfortunately this is the only way, also vice versa (from MariaDB 10.x to MySQL 8.x). There is further support in one Instructions at MariaDB.

Recommendations for you

>> The best Amazon deals <

David Wurm

Do that TechnikNews-Ding together with a great team since 2015. Works in the background on the server infrastructure and is also responsible for everything editorial. Is fascinated by current technology and enjoys blogging about everything digital. In his free time he can often be found developing webs, taking photographs or making radio.

David has already written 962 articles and left 382 comments.

Website | Facebook | Twitter | Insta | YouTube | PayPal coffee donation
notification settings
notifications about
guest
Your name, which will be shown publicly.
We will not publish your email address.

0 Comments
Inline feedback
View all comments
Cookie Consent with Real Cookie Banner