Upgrade MariaDB 10.1 to MariaDB 10.2

Shutdown current MariaDB server

mysql -u root -p {-h remote.db.server}
SHUTDOWN;
exit

For safety, backup current database files

rsync -aP /var/lib/mysql /path/to/backup/
rsync -aP /etc/mysql /path/to/backup/mysql-config

Uninstall MariaDB 10.1

apt-get remove mariadb-server

Add or replace MariaDB 10.1 with MariaDB 10.2 repositories
You can find suitable server in https://downloads.mariadb.org/mariadb/repositories
My case use server in Thailand.

#/etc/apt/sources.list.d/mariadb.list
# MariaDB 10.2 repository list - created 2017-08-28 07:37 UTC
# http://downloads.mariadb.org/mariadb/repositories/
deb [arch=amd64,i386] http://mirrors.bestthaihost.com/mariadb/repo/10.2/ubuntu xenial main
deb-src http://mirrors.bestthaihost.com/mariadb/repo/10.2/ubuntu xenial main

Install MariaDB 10.2

apt-get update
apt-get install mariadb-server

Run upgrade database command

mysql_upgrade

Stop service and edit your MariaDB server with your config

# systemd
systemctl stop mariadb
# upstart
service mysql stop
# edit config file in /etc/mysql with your config

Restart MariaDB Server

# systemd
systemctl restartmariadb
# upstart
service mysql restart