MariaDB 10.2 isn’t supported officially by Plesk Onyx, but MariaDB 10.3 was already released as the new stable version of MariaDB . So if you want to use the newest MariaDB release, it’s still possible by running MariaDB with Docker. In this tutorial, we will see how to run MariaDB 10.3 with Docker on Plesk Onyx and how to manage this second MySQL server from the Plesk web interface.
Running MariaDB with Docker
Download MariaDB Container Image
The first step is to download MariaDB container image from hub.docker.com. To do so, you have to go in the section Docker of your Plesk server and to use the enter “mariadb” in search bar to list all marise the search module available on Docker Hub. When the list will be displayed, choose the first one, which can be identified by it’s “Official” badge, and click on the button Run to download the container image and start container setup.
If you want to use another version of MariaDB, you just have to click on the button dropdown to display the list of MariaDB releases.
After few seconds to download the container image, you will be automatically redirected to the container settings page.
MariaDB container configuration
The most important settings to define are :
- Port you want to expose : click on the checkbox “Automatic port mapping” to disable it, and set the port you want to use. (do not use the port 3306, because this port is already used by the MySQL server running on your server)
- Path used for persitent storage : with Docker, you need to mount a directory inside your container to make your data persistent.
- MySQL root password
In our example, we decided to expose the port 3307, and to use /var/docker/mariadb
as directory for persistent storage. Before launching the container, make sure informations are on the proper site for the storage directory. On the left, path /var/lib/mysql
is inside the container, and on the right, /var/docker/mariadb
is the directory on your server.
For the root password, you can click on the link “Add Variable” to be able to set the variable MYSQL_ROOT_PASSWORD
and the password of your choice. In our example, we have used “your_mysql_root_password”, but replace it with a stronger password.
When your settings are properly set, you can start the container by clicking on the button “OK”
Adding MariaDB server as a remote MySQL server
To manage your new MariaDB instance, the easiest solution is to add it as a remote MySQL server in Plesk. You can find this settings in Tools & Settings > Applications & Databases > Database Servers. Then click on the button “Add a database server” :
The configuration is pretty simple, just set 127.0.0.1 as IP address, the port you have previously exposed, 3307 in our example, keep MySQL in database type option, and for the authentication part, use root as username and the ROOT password you have set on the MariaDB container settings.
Click on OK to connect our MariaDB container, and you should see two database servers listed, the MySQL server installed by Plesk, named localhost, and your MariaDB container name 127.0.0.1. You can now access to phpmyadmin by clicking on the button “customize” at the right of the line.
Upgrading MariaDB container
When new release of MariaDB is pusblished, the upgrade will not be performed automatically from the packages repository. But Plesk Docker extension make the upgrade process easy. In your Docker manager main page, with the list of all containers running on your server, click on the button “Details” to open the container management page.
On this page you will see the logs of and all other informations related to your container. To upgrade a container, you just have to click on the button “recreate”
It will open a modal pop-up, where you will be able to choose the version you want to use to recreate the container. You can choose the exact release you want, but if you only want to upgrade the container to the latest release, you can keep the settings “Latest” as image version. If there is a newer version available, the image will be automatically pulled from Docker Hub, the Plesk Docker extension, will remove the previous container version, before relaunching the new one.
And that’s it, you will only have to perform this action each time a new MariaDB release is available.