Upgrade MariaDB from 10.6 LTS to 11.8 LTS on FreeBSD

Here’s my process to upgrade MariaDB from 10.6 LTS to 11.8 LTS on FreeBSD. It’s very straighforward. I’ll be adding in some safety checks along the way, like DB and config file backups, to help ensure this upgrade goes smoothly.

First, review the official upgrade notes. There have been some changes to be aware of, including my.cnf option deprecations that could throw errors after the upgrade.

Upgrade process

Launch a root console.

su -

Backup all databases:

mysqldump --all-databases > /root/mysql-upgrade-backup-$(date +%Y%m%d).sql

Back up all config files:

tar -cvzf /root/mysql_config_backup_$(date +%Y%m%d).tar.gz /usr/local/etc/mysql

Stop the MariaDB service:

service mysql-server stop

There’s no need to remove the old MariaDB packages. They’ll be automatically removed when the new version is installed.

Install the new version (this also installs the -client package):

pkg install mariadb118-server

You’ll see output like the following, showing the old packages will be removed. Enter y to proceed.

Checking integrity... done (3 conflicting)
  - mariadb118-client-11.8.5 [FreeBSD] conflicts with mariadb106-client-10.6.24 [installed] on /usr/local/bin/mariadb
  - mariadb118-client-11.8.5 [FreeBSD] conflicts with mariadb106-server-10.6.24 [installed] on /usr/local/bin/mariadb-dumpslow
  - mariadb118-server-11.8.5 [FreeBSD] conflicts with mariadb106-server-10.6.24 [installed] on /usr/local/bin/aria_chk
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 5 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
  libfmt: 12.1.0 [FreeBSD]
  mariadb118-client: 11.8.5 [FreeBSD]
  mariadb118-server: 11.8.5 [FreeBSD]

Installed packages to be REMOVED:
  mariadb106-client: 10.6.24
  mariadb106-server: 10.6.24

Number of packages to be removed: 2
Number of packages to be installed: 3

The process will require 52 MiB more space.

Proceed with this action? [y/N]:

Start the MariaDB service:

service mysql-server start

Run the post-install upgrade:

mariadb-upgrade

Inspect your sites and applications to validate the systems are working as intended!