Skip to main content

VPS: Installation of Databases

This guide was created with the following products:

(Details may vary with products from different providers but the main concepts remain the same)

Introduction

This guide provides steps for the installation of various types of databases. For this example, Ubuntu 20.04 is used as the operating system, however, equivalent commands for other Linux distros that we provide on our website are also specified. These commands must be executed via SSH, if you don't know how to connect to your server via SSH, please have a look here: Initial access (SSH).

Preparation

Before you begin with the installation of a database, it is firstly necessary to ensure that the system is up to date. To do this, you need to update the packages from your system package manager with the following command, depending on your operating system:

// Ubuntu & Debian
sudo apt update

// CentOS
sudo yum update

// OpenSUSE
sudo zypper up

// Fedora
sudo dnf upgrade --refresh

Database types

Depending on which database service you want to install, follow the corresponding guide:

What is MariaDB?

MariaDB is an open-source relational database management system, originally forked from MySQL. It ensures enhanced performance, security, and continuous development. Notably, MariaDB offers improved storage engines, and its architecture provides full compatibility with MySQL. We recommend MariaDB over MySQL.

MariaDB Installation

First of all, you need to ensure that the latest MariaDB version is being installed. Some old operating systems like Debian 9 or Ubuntu 18.04 don't come by default with the latest MariaDB version in its package manager, thus by executing the following command you are making sure that the latest version is retrieved.

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

After installing the repo, update your package manager cache by following the steps provided in the preparation step section.

info

The MariaDB repo installation (step above) can be safely ignored in modern operating systems like Ubuntu 22.04 or Debian 11.

Once the repo setup has been completed, the installation of MariaDB can now begin by installing the mariadb-server package. Depending on the operating system, the following commands must be executed for this:

// Ubuntu & Debian
sudo apt install mariadb-server

// CentOS
sudo yum install mariadb-server

// OpenSUSE
sudo zypper install mariadb

// Fedora
sudo dnf install mariadb-server

MariaDB Configuration

Once the installation is complete, type in the following command to start the configuration of the server:

mysql_secure_installation

Now you can configure your MariaDB (MySQL) server by following the prompts and setting a password for your server. On the following prompt, you can skip the input for now by pressing Enter.

info

The user root is the main user of your MariaDB (MySQL) server!

Next, you will be asked if you want to set a password for the root user, confirm this with y for yes. Afterwards, you have to type in the new password for the user root.

note

While typing in the password, you won't be able to see it. However, this behavior is normal and your password will still be stored. Make sure you use a secure password for your root user and keep it in a safe place.

Now you will be asked if you want to remove anonymous users from your server, you should do this in any case for security reasons. Confirm this with a y for yes:

In the following prompt, you define if the user root is allowed to connect to the server externally. For security reasons, you should also deactivate this option and confirm this therefore with y:

In the next step, you can also confirm to remove the test database provided by MariaDB (MySQL) with y, because it is not needed and can be easily deleted:

At the end of the configuration process, you will be asked if you want to update the permissions of the database. Confirm this with y to activate the previously set password for the root user:

Your MariaDB (MySQL) server is now ready for use!

Conclusion

Congratulations, you have successfully installed and configurated database! If you have any further questions or problems, please contact our support team, who are available to help you every day!