Skip to main content

MariaDB installation guide

Plesk uses MySQL as both admin and client RDBMS. Plesk 11.5 for Linux and higher allows for MySQL alternatives (such as MariaDB or Percona Server) to be used as drop-in replacements for it. Upgrade from installations with drop-in replacements is also supported.

This guide will explain in great detail how you can replace MySQL server on a Plesk installation with MariaDB server. The guide is aimed at administrators with intermediate experience and understanding of package management for their OS. Also basic experience with services management and MySQL maintenance required.

This guide is essentially a more detailed version of the official documentation page. Please read up to the end of this guide before doing any actual changes on your server.

Repositories Setup

MariaDB is available from vendor OS repositories only on SuSE 12.2 and higher. On any other OS third-party repository should be added.

Go to https://downloads.mariadb.org/mariadb/repositories/ to generate repositories configuration appropriate for your system. Simple wizard will guide you through the process. On step 3 “Choose a Version” choose 5.5 or below. Don’t attempt to install MariaDB as drop-in replacement with version less than you had (for MySQL) before! We don’t support MySQL 5.6 and drop-in replacements based on it yet as well.

Warning: Don’t disable MariaDB repository after you’ve installed it. Plesk will require it to be enabled for updates.

Installing MariaDB

Since even on a freshly installed machine you may have parts of MySQL preinstalled, we will give a single instruction for both clean installation and drop-in replacement of MySQL. Steps that require Panel to be installed may be skipped if it is not installed yet.

Before doing drop-in replacement ensure that version of MariaDB server you are about to install is either the same (preferable) as current MySQL version, or higher. After installing a drop-in replacement you may optionally execute following command to notify Panel that MySQL component was updated:

Installing Using Yum (CentOS & RedHat)

  1. If you’re doing a drop-in replacement, backup your databases:

    If you want to dump only essential data, perform following command:

  2. Enable MariaDB repository according to Repositories Setup. You may check that repository is enabled via:
  3. Disable WatchDog module in Panel if you have one. Disable any other custom monitoring services that may resurrect MySQL daemon if you have any.
  4. Stop MySQL daemon:
  5. Check if you already have mysql-server installed:

    If you do, it must be removed before installing MariaDB (in a separate transaction than MariaDB installation!):

  6. Then remove any leftovers and install MariaDB packages in one transaction (only user commands and minimal output is shown):

    Below you will find full sample transcript:

    You can use ts command in yum shell to view current transaction contents.

  7. Optionally update configuration file (we recommend updating it, but if you have important customizations in the old one you may leave it — they should be compatible):

  8. Start MariaDB server:

  9. If you’re doing drop-in replacement, update table structure (mandatory if server version increased!):

  10. Enable WatchDog and any other service disabled on step 3.
  11. If you experience MySQL errors (especially related to InnoDB), restore backup made on step 1:

That’s it! To summarize: in case of clean (and I mean really clean, when there is no trace of MySQL installed) installation, it is sufficient to execute following command:

In all other cases this instruction should be followed.

Installing Using Apt (Debian & Ubuntu)

  1. Perform backup and stop WatchDog if you have one enabled. See Installing Using Yum (CentOS & RedHat) for details.
  2. Enable MariaDB repository according to Repositories Setup. Synchronize package index files from new sources via:
  3. Depending on your OS and selected MariaDB version, execute one of the following commands.If you are on Debian 7 or Ubuntu 12.04 (then the only possible MariaDB version is 5.5), run:

    If you are on Debian 6 or Ubuntu 10.04 and configured repositories for MariaDB 5.5, run:

    If you are on Debian 6 or Ubuntu 10.04 and configured repositories for MariaDB 5.2 or 5.3, run:

    Below you will find a sample transcript of installation recorded on Debian 6 for upgrading from mysql-server 5.1 to MariaDB 5.2:

    Please note that during installation you have an option to either retain old my.cnf or install the one packaged with MariaDB.

  4. By now MariaDB daemon is already running and automatic table structure upgrade was performed if required. If you have previously disabled WatchDog it’s now time to enable it.
  5. If you experience MySQL errors (especially related to InnoDB), restore previously created backup as described in Installing Using Yum (CentOS & RedHat).

If your machine doesn’t have any part of MySQL installed, you may greatly simplify this procedure and instead call a simple command:

If during installation you are asked to enter new MariaDB password, don’t specify it (just hit <Enter>). Otherwise Plesk will not be able to guess your password and access DB server (in other words installation will fail).

Interesting observation: if on Debian 6 or Ubuntu 10.04 and MariaDB 5.5 is installed, then libmysqlclient16 will still be provided by OS vendor. But it works quite OK with MariaDB.

Installing Using Zypper (SuSE)

This is pretty straightforward and not very demanding, given that packages are in OS vendor repo. There’s official guide to Switching between MySQL variants.

Switching to MariaDB is really easy:

  1. Perform backup and stop WatchDog if you have one enabled. See Installing Using Yum (CentOS & RedHat) for details.
  2. Stop MySQL server:
  3. Install MariaDB:

    Below you will find full sample transcript for your reference (executed on SuSE 12.2 x64):

  4. Start MariaDB server:
  5. Enable WatchDog if you need to.

You can switch back to mysql-community-server the same way. Note that while switching between MySQL variants /etc/my.cnf configuration file may be overwritten. Usually old version is saved to /etc/my.cnf.rpmsave.

Clean Installation of Plesk with MariaDB

Here and below AI means Parallels Installer or Autoinstaller.

  1. Install MariaDB using steps described in Installing MariaDB.
  2. Install Plesk 11.5.30 or later as you would normally. Make sure system MySQL server (mysql-sys AI component, “MySQL server support”) is selected if there is an option to install one packaged by Parallels:
  3. Enjoy!

Installing MariaDB as a drop-in replacement for MySQL

If you have a Plesk with MySQL and want to replace it with MariaDB, follow these steps.

  1. Upgrade to Plesk 11.5.30 or later via AI.
  2. Replace MySQL with MariaDB using steps described in Installing MariaDB.
  3. Enjoy!

If you want to install MariaDB on any previous Plesk version, you can still do that, but there are 2 caveats:

  1. You will need to somehow disable automatic package updates to Plesk via AI. Otherwise AI will attempt to install OS vendor version of MySQL, which will either fail or wreck your installation.
  2. You may encounter package dependency problems during replacing MySQL compared to the guide in Installing MariaDB.

Here’s one trick that will disable any automatic updates via AI. Place following strings in /root/.autoinstallerrc:

This will make AI fail on any operation. This will obviously disable installation of patches and update notifications as well. We do not recommend doing this! Remember that keeping your Plesk installation up-to-date is essential to keep your server secure!

Provided you succeed, such installation may later be safely upgraded to latest Plesk version. See below.

Upgrading Plesk with MariaDB

Upgrading Plesk to 11.5.30 or later with MariaDB is quite simple and doesn’t require additional steps. Just perform your normal upgrade procedure via AI.

Upgrading to versions less than 11.5 with MySQL drop-in replacements will fail, so don’t attempt it unless you know how to do it safely.

4 thoughts

  1. Miguel -

    Thanks so much for this nice tutorial. I normally use Gnome’s software update gui for updates, and I noticed that maradb show as an upgrade. Does not YUM take care of removing and installing mariadb by itself? will I have any later problems if I simply run the upgrade from the gui? I have mysql 5.5 and I want to switch to mariadb 5.5

    Your help is greatly appreciated

    Miguel

    Reply

  2. Paul -

    Nice tutorial, could you make another tutorial for plesk users who have done this upgrade to MariaDB v5.5 but would like to change to version MariaDB v10 ?

    Reply

  3. Eulises Avila -

    Please Update This Guide For New Version!

    Reply

  4. Christoforos -

    Can I have both maria and mysql runnint same server

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *