# Upgrading from MariaDB 10.1 to MariaDB 10.2

### How to Upgrade

For Windows, see [Upgrading MariaDB on Windows](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/upgrading/platform-specific-upgrade-guides/upgrading-mariadb-on-windows) instead.

For MariaDB Galera Cluster, see [Upgrading with Galera Cluster](https://app.gitbook.com/s/3VYeeVGUV4AMqrA3zwy7/galera-management/upgrading-galera-cluster) instead.

Before you upgrade, it would be best to take a backup of your database. This is always a good idea to do before an upgrade. We would recommend [mariadb-backup](https://mariadb.com/docs/server/server-usage/backup-and-restore/mariadb-backup/mariadb-backup-overview).

The suggested upgrade procedure is:

1. Modify the repository configuration, so the system's package manager installs [MariaDB 10.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.2/what-is-mariadb-102). For example,

* On Debian, Ubuntu, and other similar Linux distributions, see [Updating the MariaDB APT repository to a New Major Release](https://mariadb.com/docs/server/server-management/installing-mariadb/binary-packages/installing-mariadb-deb-files#updating-the-mariadb-apt-repository-to-a-new-major-release) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Updating the MariaDB YUM repository to a New Major Release](https://mariadb.com/docs/server/server-management/installing-mariadb/binary-packages/rpm/yum#updating-the-mariadb-yum-repository-to-a-new-major-release) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Updating the MariaDB ZYpp repository to a New Major Release](https://mariadb.com/docs/server/server-management/installing-mariadb/binary-packages/rpm/installing-mariadb-with-zypper#updating-the-mariadb-zypp-repository-to-a-new-major-release) for more information.

1. Set [innodb\_fast\_shutdown](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables#innodb_fast_shutdown) to `0`. It can be changed dynamically with [SET GLOBAL](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/set-global-sql_slave_skip_counter). For example:`SET GLOBAL innodb_fast_shutdown=0;`

* This step is not necessary when upgrading to [MariaDB 10.2.5](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.2/10.2.5) or later. Omitting it can make the upgrade process far faster. See [MDEV-12289](https://jira.mariadb.org/browse/MDEV-12289) for more information.

1. [Stop MariaDB](https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/starting-and-stopping-mariadb-automatically).
2. Uninstall the old version of MariaDB.

* On Debian, Ubuntu, and other similar Linux distributions, execute the following:`sudo apt-get remove mariadb-server`
* On RHEL, CentOS, Fedora, and other similar Linux distributions, execute the following:`sudo yum remove MariaDB-server`
* On SLES, OpenSUSE, and other similar Linux distributions, execute the following:`sudo zypper remove MariaDB-server`

1. Install the new version of MariaDB.

* On Debian, Ubuntu, and other similar Linux distributions, see [Installing MariaDB Packages with APT](https://mariadb.com/docs/server/server-management/installing-mariadb/binary-packages/installing-mariadb-deb-files#installing-mariadb-packages-with-apt) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Installing MariaDB Packages with YUM](https://mariadb.com/docs/server/server-management/installing-mariadb/binary-packages/rpm/yum#installing-mariadb-packages-with-yum) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Installing MariaDB Packages with ZYpp](https://mariadb.com/docs/server/server-management/installing-mariadb/binary-packages/rpm/installing-mariadb-with-zypper#installing-mariadb-packages-with-zypp) for more information.

1. Make any desired changes to configuration options in [option files](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files), such as `my.cnf`. This includes removing any options that are no longer supported.
2. [Start MariaDB](https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/starting-and-stopping-mariadb-automatically).
3. Run [mysql\_upgrade](https://mariadb.com/docs/server/clients-and-utilities/legacy-clients-and-utilities/mysql_upgrade).

* `mysql_upgrade` does two things:
  1. Ensures that the system tables in the `[mysq](../../../../reference/sql-statements-and-structure/sql-statements/administrative-sql-statements/system-tables/the-mysql-database-tables/README.md) l` database are fully compatible with the new version.
  2. Does a very quick check of all tables and marks them as compatible with the new version of MariaDB .

### Incompatible Changes Between 10.1 and 10.2

On most servers upgrading from 10.1 should be painless. However, there are some things that have changed which could affect an upgrade:

#### InnoDB Instead of XtraDB

[MariaDB 10.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.2/what-is-mariadb-102) uses [InnoDB](https://mariadb.com/docs/server/server-usage/storage-engines/innodb) as the default storage engine, rather than XtraDB, used in [MariaDB 10.1](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.1/changes-improvements-in-mariadb-10-1) and before. See [Why does MariaDB 10.2 use InnoDB instead of XtraDB?](https://github.com/mariadb-corporation/docs-server/blob/test/kb/en/why-does-mariadb-102-use-innodb-instead-of-xtradb/README.md) In most cases this should have minimal effect as the latest InnoDB has incorporated most of the improvements made in earlier versions of XtraDB. Note that certain [XtraDB system variables](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables) are now ignored (although they still exist so as to permit easy upgrading).

#### Options That Have Changed Default Values

In particular, take note of the changes to [innodb\_strict\_mode](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables), [sql\_mode](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#sql_mode), [binlog\_format](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables), [binlog\_checksum](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables) and [innodb\_checksum\_algorithm](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables).

| Option                                                                                                                                                                              | Old default value                                                                                                                                    | New default value                                                                                       |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| [aria\_recover(\_options)](https://mariadb.com/docs/server/server-usage/storage-engines/aria/aria-system-variables#aria_recover_options)                                            | NORMAL                                                                                                                                               | BACKUP, QUICK                                                                                           |
| [binlog\_annotate\_row\_events](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables)                                | OFF                                                                                                                                                  | ON                                                                                                      |
| [binlog\_checksum](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables)                                             | NONE                                                                                                                                                 | CRC32                                                                                                   |
| [binlog\_format](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables)                                               | STATEMENT                                                                                                                                            | MIXED                                                                                                   |
| [group\_concat\_max\_len](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#group_concat_max_len)                                                         | 1024                                                                                                                                                 | 1048576                                                                                                 |
| [innodb\_autoinc\_lock\_mode](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                          | 1                                                                                                                                                    | 2                                                                                                       |
| [innodb\_buffer\_pool\_dump\_at\_shutdown](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                             | OFF                                                                                                                                                  | ON                                                                                                      |
| [innodb\_buffer\_pool\_dump\_pct](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                      | 100                                                                                                                                                  | 25                                                                                                      |
| [innodb\_buffer\_pool\_instances](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                      | 8                                                                                                                                                    | Varies                                                                                                  |
| [innodb\_buffer\_pool\_load\_at\_startup](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                              | OFF                                                                                                                                                  | ON                                                                                                      |
| [innodb\_checksum\_algorithm](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                          | innodb                                                                                                                                               | crc32                                                                                                   |
| [innodb\_file\_format](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                                 | Antelope                                                                                                                                             | Barracuda                                                                                               |
| [innodb\_large\_prefix](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                                | OFF                                                                                                                                                  | ON                                                                                                      |
| [innodb\_lock\_schedule\_algorithm](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                    | VATS                                                                                                                                                 | FCFS                                                                                                    |
| [innodb\_log\_compressed\_pages](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                       | OFF                                                                                                                                                  | ON                                                                                                      |
| [innodb\_max\_dirty\_pages\_pct\_lwm](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                  | 0.001000                                                                                                                                             | 0                                                                                                       |
| [innodb\_max\_undo\_log\_size](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                         | 1073741824                                                                                                                                           | 10485760                                                                                                |
| [innodb\_purge\_threads](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                               | 1                                                                                                                                                    | 4                                                                                                       |
| [innodb\_strict\_mode](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                                 | OFF                                                                                                                                                  | ON                                                                                                      |
| [innodb\_undo\_directory](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                              | .                                                                                                                                                    | NULL                                                                                                    |
| [innodb\_use\_atomic\_writes](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                          | OFF                                                                                                                                                  | ON                                                                                                      |
| [innodb\_use\_trim](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)                                                                    | OFF                                                                                                                                                  | ON                                                                                                      |
| [lock\_wait\_timeout](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#lock_wait_timeout)                                                                | 31536000                                                                                                                                             | 86400                                                                                                   |
| [log\_slow\_admin\_statements](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#log_slow_admin_statements)                                               | OFF                                                                                                                                                  | ON                                                                                                      |
| [log\_slow\_slave\_statements](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables)                                 | OFF                                                                                                                                                  | ON                                                                                                      |
| [log\_warnings](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#log_warnings)                                                                           | 1                                                                                                                                                    | 2                                                                                                       |
| [max\_allowed\_packet](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#max_allowed_packet)                                                              | 4M                                                                                                                                                   | 16M                                                                                                     |
| [max\_long\_data\_size](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#max_long_data_size)                                                             | 4M                                                                                                                                                   | 16M                                                                                                     |
| [myisam\_recover\_options](https://mariadb.com/docs/server/server-usage/storage-engines/myisam-storage-engine/myisam-system-variables#myisam_recover_options)                       | NORMAL                                                                                                                                               | BACKUP, QUICK                                                                                           |
| [optimizer\_switch](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#optimizer_switch)                                                                   | See [Optimizer Switch](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/optimizer-switch) for details. |                                                                                                         |
| [replicate\_annotate\_row\_events](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables)                             | OFF                                                                                                                                                  | ON                                                                                                      |
| [server\_id](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables)                                                   | 0                                                                                                                                                    | 1                                                                                                       |
| [slave\_net\_timeout](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables)                                          | 3600                                                                                                                                                 | 60                                                                                                      |
| [sql\_mode](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#sql_mode)                                                                                   | NO\_AUTO\_CREATE\_USER, NO\_ENGINE\_SUBSTITUTION                                                                                                     | STRICT\_TRANS\_TABLES, ERROR\_FOR\_DIVISION\_BY\_ZERO, NO\_AUTO\_CREATE\_USER, NO\_ENGINE\_SUBSTITUTION |
| [thread\_cache\_size](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#thread_cache_size)                                                                | 0                                                                                                                                                    | Auto                                                                                                    |
| [thread\_pool\_max\_threads](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/buffers-caches-and-threads/thread-pool/thread-pool-system-status-variables) | 1000                                                                                                                                                 | 65536                                                                                                   |
| [thread\_stack](https://mariadb.com/docs/server/variables-and-modes/server-system-variables#thread_stack)                                                                           | 295936                                                                                                                                               | 299008                                                                                                  |

#### Options That Have Been Removed or Renamed

The following options should be removed or renamed if you use them in your [option files](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files):

| Option                                                                                                                             | Reason                                                                                                                                                                                                                                                                                                                    |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| aria\_recover                                                                                                                      | Renamed to [aria\_recover\_options](https://mariadb.com/docs/server/server-usage/storage-engines/aria/aria-system-variables#aria_recover_options) to match [myisam\_recover\_options](https://mariadb.com/docs/server/server-usage/storage-engines/myisam-storage-engine/myisam-system-variables#myisam_recover_options). |
| [innodb\_additional\_mem\_pool\_size](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables) | Deprecated in [MariaDB 10.0](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.0/changes-improvements-in-mariadb-10-0).                                                                                                                                                                     |
| [innodb\_api\_bk\_commit\_interval](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)   | Memcache never implemented in MariaDB.                                                                                                                                                                                                                                                                                    |
| [innodb\_api\_disable\_rowlock](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)       | Memcache never implemented in MariaDB.                                                                                                                                                                                                                                                                                    |
| [innodb\_api\_enable\_binlog](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)         | Memcache never implemented in MariaDB.                                                                                                                                                                                                                                                                                    |
| [innodb\_api\_enable\_mdl](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)            | Memcache never implemented in MariaDB.                                                                                                                                                                                                                                                                                    |
| \[                                                                                                                                 | innodb\_api\_trx\_level]\(../../../../reference/storage-engines/innodb/innodb-system-variables.md)                                                                                                                                                                                                                        |
| [innodb\_use\_sys\_malloc](https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables)            | Deprecated in [MariaDB 10.0](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.0/changes-improvements-in-mariadb-10-0).                                                                                                                                                                     |

#### Reserved Words

New [reserved words](https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/reserved-words): OVER, RECURSIVE and ROWS. These can no longer be used as [identifiers](https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-names) without being quoted.

#### TokuDB

[TokuDB](https://mariadb.com/docs/server/server-usage/storage-engines/legacy-storage-engines/tokudb) has been split into a separate package, mariadb-plugin-tokudb.

#### Replication

[Replication](https://mariadb.com/docs/server/ha-and-performance/standard-replication) from legacy MySQL servers may require setting [binlog\_checksum](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables) to NONE.

#### SQL Mode

[SQL\_MODE](https://mariadb.com/docs/server/server-management/variables-and-modes/sql_mode) has been changed; in particular, NOT NULL fields with no default will no longer fall back to a dummy value for inserts which do not specify a value for that field.

#### Auto\_increment

[Auto\_increment](https://mariadb.com/docs/server/reference/data-types/auto_increment) columns are no longer permitted in [CHECK constraints](https://mariadb.com/docs/server/reference/sql-statements/data-definition/constraint), [DEFAULT value expressions](https://mariadb.com/docs/server/server-usage/tables/create-table#default) and [virtual columns](https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/generated-columns). They were permitted in earlier versions, but did not work correctly.

#### TLS

Starting with [MariaDB 10.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.2/what-is-mariadb-102), when the user specifies the `--ssl` option with a [client or utility](https://github.com/mariadb-corporation/docs-server/blob/test/kb/en/clients-utilities/README.md), the [client or utility](https://github.com/mariadb-corporation/docs-server/blob/test/kb/en/clients-utilities/README.md) will not [verify the server certificate](https://mariadb.com/docs/server/security/encryption/data-in-transit-encryption/secure-connections-overview#server-certificate-verification) by default. In order to verify the server certificate, the user must specify the `--ssl-verify-server-cert` option to the [client or utility](https://github.com/mariadb-corporation/docs-server/blob/test/kb/en/clients-utilities/README.md). For more information, see the [list of options](https://mariadb.com/docs/server/clients-and-utilities/mariadb-client/mysql-command-line-client#options) for the [mysql](https://mariadb.com/docs/server/clients-and-utilities/mariadb-client/mysql-command-line-client) client.

### Major New Features To Consider

You might consider using the following major new features in [MariaDB 10.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.2/what-is-mariadb-102):

* [Window Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions)
* [mysqlbinlog](https://mariadb.com/docs/server/clients-and-utilities/logging-tools/mariadb-binlog) now supports continuous binary log backups
* [Recursive Common Table Expressions](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/common-table-expressions/recursive-common-table-expressions-overview)
* [JSON functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions)
* See also [System Variables Added in MariaDB 10.2](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/system-variables/system-and-status-variables-added-by-major-release/system-and-status-variables-added-by-major-unmaintained-release/system-variables-added-in-mariadb-102).

### See Also

* [The features in MariaDB 10.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.2/what-is-mariadb-102)
* [Upgrading from MariaDB 10.1 to MariaDB 10.2 with Galera Cluster](https://github.com/mariadb-corporation/docs-server/blob/test/server/server-management/getting-installing-and-upgrading-mariadb/upgrading/upgrading-to-unmaintained-mariadb-releases/upgrading-from-mariadb-101-to-mariadb-102-with-galera-cluster/README.md)
* [Upgrading from MariaDB 10.0 to MariaDB 10.1](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/upgrading/mariadb-community-server-upgrade-paths/upgrading-to-unmaintained-mariadb-releases/upgrading-from-mariadb-100-to-mariadb-101)
* [Upgrading from MariaDB 5.5 to MariaDB 10.0](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/upgrading/mariadb-community-server-upgrade-paths/upgrading-to-unmaintained-mariadb-releases/upgrading-from-mariadb-10-4-to-mariadb-10-5)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
