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.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- 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
- 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
- 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}-*
- Start up the MySQL Server
Use
systemctl
to start up themysqld
service:[cloud_user@host]$ sudo systemctl start mysqld
- 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
- 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