Installation of MySQL on CentOS 7, Hostripples Web Hosting

Installation of MySQL on CentOS 7

In continuation to our previous tutorial where we cleared all the basic concepts related to MySQL and MariaDB.

In this tutorial we are going to learn how to install MySQL on CentOS 7.

Prerequisites:

For following tutorial you will need CentOS 7 with a non-root user with sudo privileges.

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.

1 . Download the rpm packages:

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 ==>

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Select the latest version of the MySQL i.e. Version of CentOS 7 Version 7 Red Hat Linux 7 version ==> Download ==>

Installation of MySQL on CentOS 7, Hostripples Web Hosting

A  prompt will appear asking for login ==> ignore it ==> select No, thanks just start my download ==> Right click and copy link address.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Then run wget  command as follows:

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Wgate is a non-interactive downloader i.e. it helps in downloading the files in an no-interactive way. It is a free function. we can retrieve files from HTTP, HTTPS and FTP Protocol.

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

Installation of MySQL on CentOS 7, Hostripples Web Hosting

It is verified that the file is not corrupted so we start installing MySQL server. The output will be:

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Compare this output with your RPM MD5. It should be same.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Now that we have verified the output, let’s start installing the MySQL.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

It adds two new yum repositories we will use them for installation.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Installation of MySQL on CentOS 7, Hostripples Web Hosting

It will prompt for continuation . Press Y for continuation. It will also prompt for accepting a GPG key. Press Y and finish the installation.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Press ‘Y” and installation will start as follows:

Installation of MySQL on CentOS 7, Hostripples Web Hosting

It will then prompt for GPG key. Press : ‘Y” following will be the output:

Installation of MySQL on CentOS 7, Hostripples Web Hosting

  1. Starting MySQL :

Start the daemon mysqld using following command

Systemctl is used when we want to check the status of the system services and also want to enable, start, Restart, Reload, stop the system services like MySQL.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

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.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Final line should show this:

Installation of MySQL on CentOS 7, Hostripples Web Hosting

MySQL has a default behaviour of starting at the time of boot when it is installed. Using following command we can change its default behaviour.

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.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Output :

Installation of MySQL on CentOS 7, Hostripples Web Hosting

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 :

Installation of MySQL on CentOS 7, Hostripples Web HostingIt 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.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

Once you get the strength it will again ask you to change it . type NO.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

It will then prompt for remove anonymous users, Disallow root login remotely, remove test database, reload test database & access it? enter Y for all the options.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

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.

Installation of MySQL on CentOS 7, Hostripples Web Hosting

This indicates that we have completed the installation successfully

Installation of MySQL on CentOS 7, Hostripples Web Hosting

 


Installation of MySQL on CentOS 7, Hostripples Web Hosting
Vishwajit Kale
Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.