The recently released MariaDB 10.2 includes a lot in interesting new features, making it extremely worthwhile to attempt an upgrade sooner rather than later.
The knowledge base of MariaDB does provide useful general information of what to do, but I decided to share the commands involved to upgrade the database on Debian / Ubuntu , with the repos from MariaDB itself.
As a golden rule for sys admins, never forget to make a backup whenever you’re fiddling with database settings or versions. So, first things first.
Backup all database on your server:
mysqldump --all-databases -p > \tmp\db-backup.sql
Before you go on, make sure to check the file, and see if it actually contains from SQL statements. You could do so with the tail command.
When all is fine, continue.
Before shutting down, set ‘innodb_fast_shutdown‘ to 0. You can do so in the query console.
First, I checked the previous value:
MariaDB [(none)]> show variables like 'innodb_fast_shutdown'; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | innodb_fast_shutdown | 1 | +----------------------+-------+
Update the value (this method does not persist the value after restart):
MariaDB [(none)]> SET GLOBAL innodb_fast_shutdown= 0;
Checking its new value with the previous command should show it with value=0, rather than 1.
Next, shutdown your database:
$ sudo service mysql stop
Here is actually the ideal time to backup your database, so if you didn’t already, do it here!
MariaDB have excellent repositories and an online tool to create the commands needed to setup your apt repositories to add mariadb to your system.
You have two options here. Either you update your /etc/apt/sources.list file yourself to use the new repository for 10.2, or you remove the old entry and use MariaDB’s repository page to generate the commands to execute for you.
I’ll do the first one. To know the new location, I used the MariaDB download tool to locate the repository URL. For Ubuntu Xenial, this turned out to be:
http://mariadb.cu.be/repo/10.2/ubuntu xenial main
Hence, I just updated my sources.list , and changed the 10.1 url to 10.2.
Next, update apt ant upgrade mariaDB.
$ sudo apt update $ sudo apt list --upgradable | grep mariadb libmariadbclient18/unknown 10.2.7+maria~xenial amd64 [upgradable from: 10.1.24+maria-1~xenial] mariadb-client/unknown,unknown,unknown 10.2.7+maria~xenial all [upgradable from: 10.1.24+maria-1~xenial] mariadb-common/unknown,unknown,unknown 10.2.7+maria~xenial all [upgradable from: 10.1.24+maria-1~xenial] mariadb-server/unknown,unknown,unknown 10.2.7+maria~xenial all [upgradable from: 10.1.24+maria-1~xenial] $ sudo apt install mariadb-server
Now that we’ve installed the newer version, its also worth mentioning that you might want to edit your my.cnf file to make use of the new features via new configuration variables, or change some settings due to the default values having been modified between 10.1 and 10.2.
Again, more information about these at MariaDB’s upgrade page. Personally, I haven’t had to change anything, and my upgrade was painless, ie. everything worked as needed after starting up the server again via:
$ sudo service mysql start