- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
- Security
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.
Lab Info
Table of Contents
-
Challenge
Install the mariadb and mariadb-server Software Packages
Use YUM to install
mariadb-serverandmariadbpackages:sudo yum -y install mariadb-server mariadb -
Challenge
Ensure That the mariadb.service Starts and Is Enabled to Start at Boot Time
Use the
systemctlcommand 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_installationto set the the database server'srootpassword toL12i3n4u5Xrocks. Then follow the prompts to remove anonymous users, disallow remoterootlogins, remove thetestdatabase, 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
mysqlto connect to the database as therootuser with the passwordL12i3n4u5Xrocks. Create a database namedpeople, a'dbadmin'@'localhost'user identified by the passwordSeQuel2001. Then, grant all rights to thepeopledatabase 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
mysqlto log in as the userdbadmin, and provide theSeQeuL2001password. Use thepeopledatabase, create and drop a minimaltesttable, to verify administrative privileges and exit:mysql -u dbadmin -p use people; create table test (id text); drop table test; exit
About the author
Real skill practice before real-world application
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.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.