- Lab
- A Cloud Guru
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.
Path Info
Table of Contents
-
Challenge
Install the mariadb and mariadb-server Software Packages
Use YUM to install
mariadb-server
andmariadb
packages:sudo yum -y install mariadb-server mariadb
-
Challenge
Ensure That the mariadb.service Starts and Is Enabled to Start at Boot Time
Use the
systemctl
command to enable and start themariadb.service
, then check on its status:sudo systemctl enable mariadb.service --now sudo systemctl status mariadb.service
-
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'sroot
password toL12i3n4u5Xrocks
. Then follow the prompts to remove anonymous users, disallow remoteroot
logins, remove thetest
database, and reload the privilege tables immediately:sudo mysql_secure_installation
-
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 theroot
user with the passwordL12i3n4u5Xrocks
. Create a database namedpeople
, a'dbadmin'@'localhost'
user identified by the passwordSeQuel2001
. Then, grant all rights to thepeople
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
-
Challenge
Verify the dbadmin User has Full Access to the people Database
Use
mysql
to log in as the userdbadmin
, and provide theSeQeuL2001
password. Use thepeople
database, create and drop a minimaltest
table, to verify administrative privileges and exit:mysql -u dbadmin -p use people; create table test (id text); drop table test; exit
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.