Language & currency
Currency

Gratis Website & Server Migratie

Kolonel Server
MariaDB Upgrade - Upgrade Your Database Safely

Understanding MariaDB

MariaDB is an open-source relational database management system derived from MySQL. It is widely used in web hosting environments, business applications, e-commerceplatforms, analytics systems, en contentmanagementsystemen. Because it is compatible with many MySQL-based applications, MariaDB has become a preferred database engine for Linux servers.

Applications and supported operating systems may require a newer database release. Diagnose the exact compatibility error first: MariaDB’s JSON type is not identical to MySQL’s binary JSON implementation, and an upgrade alone is not a universal fix for SQL errors.

Vereisten

This workflow illustrates a standalone MariaDB 10.11 naar 11.4 major-version upgrade on a supported Ubuntu release. Check both vendors’ support matrices and the version-specific upgrade notes. Other starting versions, Galera clusters, replication topologies and control-panel-managed databases require their own procedures.

mariadb --version
sudo mariadb -e "SELECT VERSION();"
lsb_release -ds
apt-cache policy mariadb-server

Record installed packages, plugins, repositories and database settings. Test a restored copy of the workload first, reserve downtime and verify off-server backupS. Do not combine an untested OS migration and database upgrade in one maintenance step.

Why Create a Backup Before Upgrading?

Database upgrades modify system packages and internal database structures. Although upgrades generally complete without problems, unexpected issues such as package conflicts, interrupted installations, or storage failures can cause service disruptions.

Creating a complete backup before starting allows you to restore your data if anything goes wrong during the process.

Wordpress Hosting

WordPress-webhosting

Vanaf $ 3,99/maandelijks

Koop nu

Stap 1: Create and Test a Backup

Use a MariaDB Backup version compatible with the source database. Put the backup account credentials in /root/.mariadb-backup.cnf with permissions 600; grant only the privileges required by the backup tool. Keep credentials out of shell arguments.

sudo mariadb-backup --defaults-extra-file=/root/.mariadb-backup.cnf --backup --target-dir=/data/backup/preupgrade
sudo mariadb-backup --prepare --target-dir=/data/backup/preupgrade

Copy the prepared backup off the server and test restoration into a separate source-version environment. Preserve configuration, encryption keys and package/repository information. A successful command or a nonempty directory is not proof that recovery works.

Stap 2: Stop the MariaDB Service

Put applications into maintenance mode and stop background writers first. Confirm the database shuts down cleanly. Keep the original data directory and backup; do not purge packages or delete database files.

The database service should be stopped before removing the current version.

sudo systemctl stop mariadb

You can confirm that the service has stopped by running:

sudo systemctl status mariadb

Stap 3: Remove the Existing MariaDB Installation

To install a newer MariaDB release, remove the current server package first.

Cheap VPS

Goedkope VPS-server

Vanaf $ 2,99/maandelijks

Koop nu
sudo apt-get remove mariadb-server

This command removes the server package while leaving your database files intact. Your previously created backup remains available as an additional safety measure.

Stap 4: Configure the Target Repository and Install

Use MariaDB’s repository configuration for the chosen Ubuntu release and target 11.4 series. Download any setup script from the official source, compare it with the currently published checksum and inspect it before running it. An old checksum copied from a tutorial is not a valid check for a changing download.

Remove conflicting repository definitions without mixing Ubuntu and vendor packages unintentionally. After configuring the target repository, inspect the candidate and simulated changes:

sudo apt update
apt-cache policy mariadb-server mariadb-backup
sudo apt-get -s install mariadb-server mariadb-backup

Continue only if the candidate is the intended series and the proposed dependency changes are acceptable:

sudo apt install mariadb-server mariadb-backup

The package scripts may start the service. Review its logs and incompatible configuration options before allowing application traffic.

Stap 5: Configure and Upgrade MariaDB

After installation, use systemd to manage the MariaDB service.

Windows VPS

Windows VPS-hosting

Toegang op afstand en volledig beheer

Koop nu

Common MariaDB Service Commands

Operation Command
Start Service sudo systemctl start mariadb
Stop Service sudo systemctl stop mariadb
Restart Service sudo systemctl restart mariadb
Enable at Boot sudo systemctl enable mariadb
Disable at Boot sudo systemctl disable mariadb
View Status sudo systemctl status mariadb

Upgrade Internal Database Structures

Start the service and run the MariaDB upgrade utility to update system tables and resolve compatibility issues.

sudo mariadb-upgrade

This utility checks the existing database structure and applies any changes required by the newer MariaDB version.

Start MariaDB

Once the upgrade process is complete, start the database service.

sudo systemctl start mariadb

Verify the Upgrade

Connect to the database server using the MariaDB client.

sudo mariadb

You should see output similar to the following:

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 11.4.x-MariaDB MariaDB Server (example)

The displayed version confirms that the server is running the upgraded release.

You can also check the version directly with:

SELECT VERSION();

Review the returned value and ensure it matches the version you intended to install.

Post-Upgrade Checks

Test reads, writes, scheduled jobs, authentication, stored routines and application-specific queries before ending maintenance. If rollback is required, restore the tested pre-upgrade backup into the original supported version. Do not attempt a package downgrade against the modified data directory.

After confirming the upgrade, review your applications and services that rely on MariaDB. Check website functionality, application logs, scheduled tasks, and database connections to verify everything is operating normally.

If custom MariaDB settings were previously configured, review the server option files and confirm that all required parameters remain compatible with the new release.

Deel dit bericht

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *