Downgrading between Major Versions of MariaDB
Downgrading MariaDB is not officially supported supported between major version.
For minor versions, upgrade is supported to a earlier gamma/RC/GA version as we do not change the storage format after Alpha and very rarely during Beta (it has to be very critical bug to require such a change). There are a few very rear cases when incompatible changes happens on GA version, for example MariaDB 10.1.21 fixed a file format incompatibility bug that prevents a downgrade to earlier MariaDB 10.1 releases. After 10.1.21 this has not happened in a GA release.
The main reason why downgrade between major version does not work are: - Changes in the privilege/status tables in the MySQL schema. These changes happens between most major versions as we are continuously improving the privilege system. - Changes that affects how data is stored on disk. This happens more rarely and is usually table specific. For example , if one has used Instant add column on a table in 10.3, that table cannot be opened in 10.2. - Between major releases, there are often substantial changes, even if none of the new features are used. For example, both MariaDB 10.2 and MariaDB 10.3 introduce new versions of the redo log.
The only reliable way to downgrade is to restore from a full backup made before upgrading, and start the old version of MariaDB.
Some people have reported successfully downgrading, but there are many possible things that can go wrong, and downgrading between two major version is not tested in any way by the MariaDB developers.
In general, one can downgrade a major version to an earlier version if one has not yet run mariadb-upgrade on the new version. Note however that it's recommend that one always uses mariadb-upgrade after upgrading to a new major version as otherwise some security features in the new server may not work and tables that have indexes using a character collation that has changed may not work properly.
Assuming one must downgrade to an earlier major version, here is a list of things one has to do:
- MariaDB must be shut down cleanly. This means that:
- One should ensure that innodb_fast_shutdown is set to 0.
- One uses the SHUTDOWN command, mariadb-admin shutdown or the operating system official commands, like systemctl stop mariadb.service.
- Start the old server with --skip-privilege-tables.
- Use ALTER TABLE to restore the mysql schema tables to their original definition or drop and recreate the mysql tables. One can find the old definition by using mariadb-install-db to create separate temporary data directory. Starting the MariaDB server on the temporary directory will allow you to use SHOW CREATE TABLE to find the old definition.
- Execute FLUSH PRIVILEGES to reload the old tables.
The cases when the above will not work are when table format has changed in an incompatible manner. In this case one the affected tables may note be usable in the earlier version.
The following is an incomplete list of when one will not be able to use a table in an earlier major version:
- MariaDB 10.4 -> MariaDB 10.3
- Any InnoDB table one has used
ALTER TABLE ALGORITHM=INSTANT DROP COLUMN
- In 10.4 MariaDB mysql.user table was replaced by mysql.global_priv table which may cause problems if ones wants to downgrade to 10.3.
- Any InnoDB table one has used
- MariaDB 10.3 -> MariaDB 10.2
- Any InnoDB table one which one has used
ALTER TABLE ALGORITHM=INSTANT ADD COLUMN
.
- Any InnoDB table one which one has used