In addition to databases that store websites data, Plesk has its own database for storing information about customer and resellers accounts, their subscriptions, and so on. This database is called psa and located on the local MySQL server. The local MySQL server is installed together with Plesk and is required for Plesk functioning. However, since version 11.5, you can replace the local MySQL server with an alternative database server, for example, MariaDB (https://mariadb.org) or Percona Server (http://www.percona.com/software/percona-server)

Below in this section we will explain how to replace MySQL with MariaDB. For other MySQL replacements, instructions are basically the same.

Using MariaDB or Percona as the Default Database Server

Below we will provide instructions on replacing MySQL server with MariaDB server. For Percona Server, the steps are the same, the only differences are in configuring repositories and package names.

To replace your MySQL server with MariaDB:

  1. Back up databases located on your MySQL server. Use one of the following commands:

    • To back up all databases:

      # mysqldump -uadmin -p`< /etc/psa/.psa.shadow ` --all-databases | gzip > /root/mysql.all.dump.sql.gz
      
    • To back up only data required by Plesk:

      # mysqldump -uadmin -p`< /etc/psa/.psa.shadow ` --databases mysql psa apsc | gzip > /root/mysql.mysql-psa-apsc.dump.sql.gz
      
  2. Configure the MariaDB repository on your server. To generate the repository configuration for your operating system, use the wizard available at https://downloads.mariadb.org/mariadb/repositories/. When selecting the MariaDB version, choose the version not less than your current MySQL version. The versions of MariaDB currently supported by Plesk are 5.5, 10.0, and 10.1.

    Note: Once you install MariaDB, do not disable this repository on your server. Plesk requires it for updates.

  3. Stop the Watchdog Plesk extension if it is installed on your server and stop other monitoring services that can start the mysql service once you stop it manually.

  4. Install MariaDB using one of the instructions provided below.

  5. Switch on Watchdog and start other services you stopped in step 3.

  6. Notify Plesk about the changes in the MySQL component:

    plesk sbin packagemng --set-dirty-flag
    
  7. (Optional) If you experience MySQL errors after updating, restore the backup you created in step 1:

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

To install MariaDB on CentOS or RedHat:

  1. Stop the mysql service:

    service mysqld stop
    
  2. Remove the MySQL server from your server:

    rpm -e --nodeps `rpm -q --whatprovides mysql-server`
    
  3. Remove any leftovers of MySQL and install MariaDB:

    Note: This will not remove any Plesk packages except plesk-mysql.

    yum shell
    > remove mysql mysql-server plesk-mysql
    > install MariaDB-server MariaDB-client MariaDB-compat MariaDB-shared
    > run
    
  4. (Optional) Repalce your MySQL configuration file /etc/my.cnf with the the MariaDB server’s default one. This step is required if you are not sure that MariaDB can work with your configuration file. Usually, MariaDB is compatible with MySQL configuration files.

    [ -f /etc/my.cnf.rpmnew ] && mv /etc/my.cnf.rpmnew /etc/my.cnf
    
  5. Start the MariaDB server:

    service mysql start
    
  6. Update the tables structure:

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

    If you experience MySQL errors after updating, restore the backup you created in step 1:

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

To install MariaDB on Debian or Ubuntu:

  1. Synchronize package index files from new sources:

    apt-get update
    
  2. Depending on your OS and the selected MariaDB version, run one of the following commands:

    • On Ubuntu 14.04:

      env DEBIAN_FRONTEND=noninteractive apt-get -o OrderList::Score::Immediate=1000 install libmariadbclient18 mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server mariadb-server-10.1 mariadb-server-core-10.1
      dpkg -i --force-overwrite /var/cache/apt/archives/mariadb-server-10.1_10.1.11+maria-1~trusty_amd64.deb
      dpkg --configure -a
      apt-get install -f
      
    • On Debian 7 or Ubuntu 12.04 (in this case, the only available MariaDB version is 5.5):

      env DEBIAN_FRONTEND=noninteractive apt-get -o OrderList::Score::Immediate=1000 install mariadb-server mysql-common libmariadbclient18
      
    • On Ubuntu 10.04 and configured repositories for MariaDB 5.5:

      env DEBIAN_FRONTEND=noninteractive apt-get -o OrderList::Score::Immediate=1000 install mariadb-server mysql-common
      
    • On Ubuntu 10.04 and configured repositories for MariaDB 5.2 or 5.3:

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

      Note: If during the installation the system asks you to provide the MariaDB password, leave it empty. Otherwise, Plesk will be unable to access the MariaDB server and installation will fail.

To perform a clean installation of Plesk with MariaDB:

  1. Configure the MariaDB repository as described above.

  2. Install MariaDB using instructions provided above.

    If MySQL is not installed on the server, it is enough to run the following command:

    • On CentOS or Redhat:

      yum install MariaDB-server MariaDB-client MariaDB-compat
      
    • On Debian or Ubuntu:

      apt-get install mariadb-server
      
  3. Install Plesk 11.5 or later as described in the Plesk Installation and Upgrade Guide. Make sure that the MySQL server support component is selected.