Moving from MySQL to MariaDB in Debian 9

You are viewing an old version of this article. View the current version here.

MariaDB 10.1 is now the default mysql server in Debian 9 "Stretch". This page provides information on this change and instructions to help with upgrading your Debian 8 "Jessie" version of MySQL or MariaDB to MariaDB 10.1 in Debian 9 "Stretch".

Background Information

The version of MySQL in Debian 8 "Jessie" is 5.5. When installing, most users will install the mysql-server package, which depends on the mysql-server-5.5 package. In Debian 9 "Stretch" the mysql-server package depends on a new package called default-mysql-server. This package in turn depends on mariadb-server-10.1. There is no default-mysql-server package in Jessie.

In both Jessie and Stretch there is also a mariadb-server package which is a MariaDB-specific analog to the mysql-server package. In Jessie this package depends on mariadb-server-10.0 and in Stretch this package depends on mariadb-server-10.1 (the same as the default-mysql-server package).

So, the main repository difference in Debian 9 "Stretch" is that when you install the mysql-server package on Stretch you will get MariaDB 10.1 instead of MySQL, like you would with previous versions of Debian.

All apps and tools, such as the popular LAMP stack, in the repositories that depend on the mysql-server package will continue to work using MariaDB as the database. For new installs there is nothing different that needs to be done when installing the mysql-server or mariadb-server packages.

Before you upgrade

If you are currently running MySQL 5.5 on Debian 8 "Jessie" and are planning an upgrade to Debian 9 "Stretch", there are some things to keep in mind:

First, this is a major upgrade, and so complete database backups are a must before you begin!

Second, the Upgrading MariaDB section contains several articles on upgrading from MySQL to MariaDB and from one version of MariaDB to another. For upgrade purposes, MySQL 5.5 and MariaDB 5.5 are very similar. In particular, see the Upgrading from MariaDB 5.5 to MariaDB 10.0 and Upgrading from MariaDB 10.0 to MariaDB 10.1 articles. Both of these detail the changes in the values of default options between the releases. Review the lists to determine if you want to change them from the new defaults in your local my.cnf file.

Upgrading to MariaDB 10.1 from MySQL 5.5

The suggested upgrade procedure is:

  1. Set innodb_fast_shutdown to 0.
  2. Shutdown MySQL 5.5
  3. Take a backup
    • when the server is shut down is the perfect time to take a backup of your databases
    • store a copy of the backup on external media or a different machine for safety
  4. Perform the upgrade from Debian 8 to Debian 9
  5. During the upgrade, the mysql_upgrade script will be run automatically, this script does two things:
    1. Upgrades the permission tables in the mysql database with some new fields
    2. Does a very quick check of all tables and marks them as compatible with MariaDB 10.1
      • In most cases this should be a fast operation (depending of course on the number of tables)
  6. Add new options to my.cnf to enable features
    • If you change my.cnf then you need to restart mysqld with e.g. sudo service mysql restart or sudo service mariadb restart.

Upgrading to MariaDB 10.1 from an older version of MariaDB

If you have installed MariaDB 5.5 or MariaDB 10.0 on your Debian 8 "Jessie" machine from the MariaDB repositories you will need to upgrade to MariaDB 10.1 when upgrading to Debian 9 "Stretch". You can choose to continue using the MariaDB repositories or move to using the Debian repositories.

If you want to continue using the MariaDB repositories edit the MariaDB entry in your sources.list and change every instance of 5.5 or 10.0 to 10.1. Then upgrade as suggested above.

If you want to move to using MariaDB 10.1 from the Debian repositories, delete or comment out the MariaDB entries in your sources.list file. Then upgrade as suggested above.

If you are already using MariaDB 10.1 on your Debian 8 "Jessie" machine, you can choose to continue to use the MariaDB repositories or move to using the Debian repositories as with MariaDB 5.5 and 10.0. In either case, the upgrade will at most be just a minor upgrade from one version of MariaDB 10.1 to a newer version. In the case that you are already on the current version of MariaDB that exists in the Debian repositories or a newer one) MariaDB will not be upgraded during the system upgrade but will be upgraded when future versions of MariaDB are released.

You should always perform a compete backup of your data prior to performing any major system upgrade, even if MariaDB itself is not being upgraded!

MariaDB Galera Cluster

If you have been using MariaDB Galera Cluster 5.5 or 10.0 on Debian 8 "Jessie" it is worth mentioning that Galera Cluster is included by default in MariaDB 10.1, there is no longer a need to install a separate mariadb-galera-server package.

Comments and Suggestions

If you have comments or suggestions on things we can add or change to improve this page. Please add them as comments below.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.