In continuation to our previous tutorial where we cleared all the basic concepts related to MySQL and MariaDB.
Sudo privileges : Sudo stands for Super User Do. If we prefix any Linux command with sudo then that command will be executed with higher privileges. In simple words we can say that it helps the user to Run a command which is run in an access denied privilege area.
CentOS 7 is Linux Flavor and it uses yum package manager to download new software inside it. Since we are trying to install the latest version of MySQL we will require the rpm packages for that. These rpm packages contains the list of all the repos which are required by the yum package manager to install the software. Follow the below link for downloading the rpm packages:
Go to Chrome == > MySQL ==> Downloads ==> Yum Repository ==>
Select the latest version of the MySQL i.e. Version of CentOS 7 Version 7 Red Hat Linux 7 version ==> Download ==>
A prompt will appear asking for login ==> ignore it ==> select No, thanks just start my download ==> Right click and copy link address.
Then run wget command as follows:
Meaning of non-interactive i.e. this command can work in the background even if the user is not present or logged in. So it does not require the constant presence of the user at the time of data transfer meanwhile Wget will finish the work.
Save the rpm files, then we can verify for md5sum
It is verified that the file is not corrupted so we start installing MySQL server. The output will be:
Compare this output with your RPM MD5. It should be same.
Now that we have verified the output, let’s start installing the MySQL.
It adds two new yum repositories we will use them for installation.
It will prompt for continuation . Press Y for continuation. It will also prompt for accepting a GPG key. Press Y and finish the installation.
Press ‘Y” and installation will start as follows:
It will then prompt for GPG key. Press : ‘Y” following will be the output:
- Starting MySQL :
Start the daemon mysqld using following command
Following command is used for checking whether we have successfully started the daemon or not.
sudo systemctl status mysqld
The output will be Active if the MySQL has started successfully.
Final line should show this:
sudo systemctl disable mysqld
It creates a temporary password at the time of installation process in a log file. Take that password from log file using grep command.
Log File : These are stored in the folder /var/logs. This folder contains large no. of files and we can get information of each application.
Grep command is used to print the lines which match the pattern or for finding the text in a file.
This password will be required in the next step for securing the installation and then you need to set a new password. The default password policy has strict validations like the password should have 12 characters formed by combination of uppercase, lower case letters, number and a special character.
3. MySQL Configuration :
In this step we need to change some of the default options which are less secure. Run the following command :
It will prompt you to enter the root password. after that you are required to change it . Enter a new password and you will be given a feedback on the strength of the password.
Once you get the strength it will again ask you to change it . type NO.
Here we complete the MySQL installation securely.
4. MySQL Testing :
mysqladmin tool is used for testing the installation and also getting an information about it. It helps in running an administrative command. Use Following command.
This indicates that we have completed the installation successfully