Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Replace MySQL with MariaDB in a Plesk Server  (Read 7783 times)

0 Members and 1 Guest are viewing this topic.

Afijith

  • Guest
Replace MySQL with MariaDB in a Plesk Server
« on: March 02, 2015, 04:36:11 am »
MySQL is the Relational Database Management System (RDBMS) which is used by both admin and client in a Plesk server.

From version 11.5 onwards, Plesk allows alternatives for MySQL. MariaDB is a fork of MySQL intended to be a replacement for MySQL in most cases. It has pretty much the same features, with some extras and claims performance improvements over the original.

We have seen replacing MySQL with MariaDB in cPanel. Here I am explaining, how we can replace MySQL server on a Plesk installation with MariaDB server.


First of all, we have to add an apt repository based on the Operating System you use.
Go to https://downloads.mariadb.org/mariadb/repositories/ to generate repositories configuration appropriate for your system. Don’t attempt to install MariaDB as drop-in replacement with version less than you had (for MySQL) before! Plesk don’t support MySQL 5.6 and drop-in replacements based on it yet as well.


Note: Do not disable MariaDB repository after you have installed it. Plesk will require it to be enabled for updates.

Installing MariaDB
================

First of all 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:

------
# plesk sbin packagemng --set-dirty-flag
------


==>>Installing Using Yum (RPM based Server)

1. For a drop-in replacement, backup your databases first:

------
# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` --all-databases | gzip > /root/mysql.all.dump.sql.gz
------

2. Enable MariaDB repository according to Repositories Setup. You may check that repository is enabled via:

------
# yum repolist enabled | grep mariadb
------

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:

------
# /etc/init.d/mysql stop
------

5. Check if you already have mysql-server installed, if you do, it must be removed before installing MariaDB.

------
# rpm -e --nodeps `rpm -q --whatprovides mysql-server`
------

6. Then remove any leftovers and install MariaDB packages.

------
# yum remove mysql mysql-server plesk-mysql

# yum install MariaDB-server MariaDB-client MariaDB-compat MariaDB-shared
------

7. Optionally you can update configuration file (If you have important customizations in the old one you may leave it)

------
# [ -f /etc/my.cnf.rpmnew ] && mv /etc/my.cnf.rpmnew /etc/my.cnf
------

8. Start MariaDB server:

------
# /etc/init.d/mysql start
------

9. Update the table structure (This is mandatory if server version was increased)

------
# mysql_upgrade -uadmin -p`< /etc/psa/.psa.shadow `
------

10. Enable any service which were disabled before as part of installation.

11. If you experience MySQL errors (especially related to InnoDB), restore backup made on step 1:

------
# zcat /root/mysql.all.dump.sql.gz | mysql -uadmin -p`< /etc/psa/.psa.shadow `
------


==>>Installing Using Apt (Aptitude based Server)

1. Perform backup and stop WatchDog if you have one enabled.

2. Enable MariaDB repository according to Repositories Setup. Synchronize package index files from new sources via:

------
# apt-get update
------

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:

------
# env DEBIAN_FRONTEND=noninteractive apt-get -o OrderList::Score::Immediate=1000 \ install mariadb-server mysql-common libmariadbclient18
------

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

------
# env DEBIAN_FRONTEND=noninteractive apt-get -o OrderList::Score::Immediate=1000 \ install mariadb-server mysql-common
------

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

------
# env DEBIAN_FRONTEND=noninteractive apt-get -o OrderList::Score::Immediate=1000 \install mariadb-server mysql-common libmariadbclient16
------

Note : 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.

That's it.


==>>Upgrading Plesk with MariaDB

Upgrading Plesk with MariaDB can be easily performed by following the normal procedure of an upgrade through Auto Installer. 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.



I hope you will try this. If you have any doubts, feel free to ask
.   :D
« Last Edit: March 02, 2015, 04:44:47 am by Afijith PS »