Google Cloud Compute Engine

How to Install MariaDB on CentOS 8 – Google Cloud

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

Install MariaDB on CentOS 8 – Google Cloud. In this guide you are going to learn how to install MariaDB which is an open-source relational database management system developed by the original developers of MySQL.

With this tutorial you can install MariaDB and secure it on CentOS 8. This tutorial tested on a virtual machine running CentOS 8 on Google Cloud Platform. So this tutorial will work on any cloud hosting or any VPS or any dedicated servers running CentOS.


  1. A system or a server running CentOS 8.
  2. SSH access to your server with root privileges.
  3. If you are on Google Cloud you can follow this guide to set up your VM Instance in Google Cloud with CentOS 8.

Update CentOS Packages

SSH to your server and start by updating the packages to its latest version using the following commands.

sudo dnf update

Install MariaDB on CentOS 8

Once the packages are upto date you can proceed with the MariaDB installation.

sudo dnf install @mariadb

This command installs MariaDB and all necessary dependencies.

Once the installation is complete you start the mariaDB server now and enable it to startup automatically on server boot.

sudo systemctl enable --now mariadb

To verify the installation you can use the following command to ensure MariaDB is up and running.

sudo systemctl status mariadb

You will get an output similar to the one below which indicates the server is running.

● mariadb.service - MariaDB 10.3 database server
    Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
    Active: active (running) since Sun 2019-12-22 07:56:21 UTC; 7s ago
      Docs: man:mysqld(8)
  Main PID: 22956 (mysqld)
    Status: "Taking your SQL requests now…"
     Tasks: 30 (limit: 9584)
    Memory: 82.9M
    CGroup: /system.slice/mariadb.service
            └─22956 /usr/libexec/mysqld --basedir=/usr

Secure MariaDB server

MariaDB has an inbuilt script mysql_secure_installation which allows you to configure the necessary security steps and setup root password.

Execute the following command to secure your MariaDB.

sudo mysql_secure_installation

Now you will be prompted to setup root password and other security related steps and shown in the screenshot.

Install and Secure MariaDB on Centos 8

Once done you are good to use your MariaDB server.

Connect to MariaDB Server

It is very simple to connect to your MariaDB with the following command.

mysql -u root -p

Enter the root password you set before while securing your server.

Now you will be greeted with a welcome message.

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.11-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>

Here you can run all your SQL queries.

Prepare yourself for a role working as an Information Technology Professional with Linux operating system


Now you have learned how to install MariaDB on your VM instance on Google Cloud Platform running CentOS 8.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.