- Lab
- A Cloud Guru
Install and Configure MySQL Server (CentOS)
MySQL server is one of the most popular and widely-used relational databases. In this Lab, you will be tasked with installing a MySQL server on CentOS 7, and ensuring that it has been properly secured.
Path Info
Table of Contents
-
Challenge
Download the MySQL RPM Bundle tar File from the MySQL Community Server Downloads Page
In the cloud_user home directory run the following:
# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar
-
Challenge
Extract the RPM Files from the MySQL Bundle tar File
In
cloud_user
’s home directory, Use thetar
command to extract the RPM files from the bundle tar file:[cloud_user@host]$ tar -xvf mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar
-
Challenge
Install the MySQL Server and Dependencies Using the `rpm` Command
In
cloud_user
’s home directory, use therpm
command to install the MySQL server and dependencies:[cloud_user@host]$ sudo rpm -Uvh mysql-community-{server,client,common,libs}-*
-
Challenge
Start up the MySQL Server
Use
systemctl
to start up themysqld
service:[cloud_user@host]$ sudo systemctl start mysqld
-
Challenge
Update the Password for the Superuser Account on the MySQL Server
Locate the temporary password for the superuser:
[cloud_user@host]$ sudo grep 'temporary password' /var/log/mysqld.log
Using the temporary password, log into the MySQL server as the
root
user:[cloud_user@host]$ # mysql -u root -p
Update the password for the
root
user:mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '<NEW_PASSWORD>';
For grading purposes, make sure NEW_PASSWORD is
Linux4me!
.Exit the mysql prompt:
mysql> exit
-
Challenge
Secure the MySQL Server Installation by Ensuring That Anonymous Users Are Removed, Remote `root` Login Is disabled, the `test` Database Has Been Removed, and the Privilege Tables Have Been Reloaded
Begin the installation by running the
mysql_secure_installation
command:cloud_user@host]$ mysql_secure_installation
Answer the following questions to complete the secure installation:
Change the password for root ? n Remove anonymous users? y Disallow root login remotely? y Remove test database and access to it? y Reload privilege tables now? y
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.