Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Securing the MariaDB Database Server

It is not enough for a System Administrator to just know how to install and enable a database server service. In today's world of cyber-security threats, it is very important to also know how to properly secure the database server. It is even essential to know how to create databases, database users, and grant database access to users. In this activity, we will be installing the MariaDB server, configuring the service to be secure, creating a database administrator, creating a database, and granting that user administrative privileges to it.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 30m
Published
Clock icon Jan 17, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Install the mariadb and mariadb-server Software Packages

    Use YUM to install mariadb-server and mariadb packages:

    sudo yum -y install mariadb-server mariadb
    
  2. Challenge

    Ensure That the mariadb.service Starts and Is Enabled to Start at Boot Time

    Use the systemctl command to enable and start the mariadb.service, then check on its status:

    sudo systemctl enable mariadb.service --now
    sudo systemctl status mariadb.service
    
  3. Challenge

    Secure the mariadb database server by Setting the root Password, Removing Anonymous Users, Not Allow Remote Root Logins, Removing the Test Databases, and Reload Privileges

    Use the mysql_secure_installation to set the the database server's root password to L12i3n4u5Xrocks. Then follow the prompts to remove anonymous users, disallow remote root logins, remove the test database, and reload the privilege tables immediately:

    sudo mysql_secure_installation
    
  4. Challenge

    Create the Database people and the User dbadmin, Then Grant 'dbadmin'@'localhost' Full Access to the people Database

    Use the command line database client command mysql to connect to the database as the root user with the password L12i3n4u5Xrocks. Create a database named people, a 'dbadmin'@'localhost' user identified by the password SeQuel2001. Then, grant all rights to the people database to the new user.

    mysql -u root -p  # Enter the password when prompted: L12i3n4u5Xrocks
    create database people;
    create user 'dbadmin'@'localhost' identified by 'SeQeuL2001';
    grant all on people.* to 'dbadmin'@'localhost';
    quit
    
  5. Challenge

    Verify the dbadmin User has Full Access to the people Database

    Use mysql to log in as the user dbadmin, and provide the SeQeuL2001 password. Use the people database, create and drop a minimal test table, to verify administrative privileges and exit:

    mysql -u dbadmin -p
    use people;
    create table test (id text);
    drop table test;
    exit
    

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans