Lab E - Install Mysql Server On Linux Distribution
Lab E - Install Mysql Server On Linux Distribution
NOTE: Before you will start this Lab, make sure that all VMs stay in OFF State. Just start
the VM for Linux CentOS.
Task 1: Install MySQL Server follow the guide.
-For this Lab you will use a VM with Linux CentOS 6.2 Distribution, when the OS stay at user stage, type
user root and password: Pa$$w0rd like credentials.
Page 1 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Page 2 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Click on Close.
This will open a new Console CLI Session for Linux OS.
Page 3 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
First, to set up the yum repository, install the mysql-community-server 5.7 RPM based on your
CentOS/RHEL release, type the following command and press Enter:
wget https://repo.mysql.com/mysql-community-release-el5-7.noarch.rpm --no-check-certificate
Page 4 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Then Once the rpm file is saved, we will verify the integrity of the download by running md5sum and
comparing it with the corresponding MD5 value listed on the site, type the command and press Enter:
md5sum mysql-community-release-el5-7.noarch.rpm
Now that we've verified that the file wasn't corrupted or changed, we'll install the package, type the
following command and press Enter:
sudo rpm -ivh mysql-community-release-el5-7.noarch.rpm
Page 5 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
This adds two new MySQL yum repositories, and we can now use them to install MySQL server, Press y to
confirm that you want to proceed. Since we've just added the package, we'll also be prompted to accept
its GPG key. Press y to download it and complete the install. Type the following command and press Enter:
Page 6 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
You will note that server start a connection to Linux CentOS.org repository to download packages and
resolve dependencies of Kernel.
Page 7 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
You will notice that some conflicts error about libraries. Type following command and press Enter:
clear
Page 8 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Review the status about your mysqld daemon, type the following command and press Enter:
Now you will to start the mysqld daemon for your service, type the following command and press Enter:
Page 9 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Review the status about your mysqld daemon, type the following command and press Enter:
service mysqld status
You will notice that your mysqld daemon for your service is UP and Running.
Page 10 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
sudo mysql_secure_installation
You change the current password for root, just press Enter to continue.
Page 11 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Now Type the new password to MySQL2019 and Press Enter. Next Re-enter the same password and press
Enter.
Page 12 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
You will notice that the process was successfully, then you need to aprobe or remove the anonymous user
access to MySQL Instance (ONLY For the Lab purpose you need aprobe). Type n and press Enter.
Now, you need to disallow root login remotely. (ONLY For the Lab purpose you need to allow). Type n and
press Enter.
Page 13 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
The MySQL by default comes with a database for test purpose with name “test”, and anyone User can
access to that. This can be a security hole in a production environment, but for the Lab purpose we don’t
remove it. Type n and Press Enter.
You need to Reload the privilege tables to ensure that changes made take effect immediately, type Y and
Press Enter.
Page 14 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
You will notice that the process for your MySQL Instace now its secure.
Page 15 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
-Then type your password for the root user configured in task 2. (this will be MySQL2019) and Press Enter.
You notice that the prompt change and you enter to MySQL Console.
Page 16 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
-Connect to your test database and show If the Database have any table, Type following:
Use test;
SHOW TABLES;
Now you will Tune MySQL Server Instance. Type the following commands and press Enter:
exit
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl --no-check-
certificate
Page 17 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Now you need to run it, type the following command and press Enter:
perl ./mysqltuner.pl
Page 18 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Now the script start to execute, you need to provide the user for MySQL admin (Type root) and Press
Enter.
Now the script start to execute, you need to provide the password for MySQL admin (Type MySQL2019)
and Press Enter.
You will notice that at the end of the Script this show you a Recommendations List.
Page 19 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Now move the bar to UP and locate the Performance Metrics List.
You notice that the script review all the Resources of Hardware and Software Settings related to your
MySQL Instance and put on OK that is normal and !! some ones that you need attention.
Now move the bar to UP and locate the Security Recommendations List.
You notice that the script review all the Accounts of Users related to your MySQL Instance and put on OK
that is normal and !! someones that you need attention.
Page 20 of 21
COURSE: MySQL Server Administration
LAB E – INSTALL MYSQL SERVER ON LINUX DISTRIBUTION
Task 4: Discussion.
1. What recommendations you receive with run the mysqltuner.pl script.
2. What command you use when download the rpm of MySQL installer.
3. What is the complete instruction that you will use for install MySQL server.
4. What command you will use to review the status about your MySQL daemon.
6. What is the complete instruction that you will use to install the rpm for MySQL server.
7. What command you will use to check the integrity of MySQL server package of rpm.
8. What is the complete instruction that you will use for secure installation about your MySQL server.
9. What is the complete instruction that you will use to enter into MySQL server Instance.
Page 21 of 21