Installation Steps For MySql Server (version 5.7.23) For Centos


MySQL is an open source free relational database management system (RDBMS) released under GNU (General Public License). It is used to run multiple databases on any single server by providing multi-user access to each created database.
Below Steps are provided for  installing MySQL 5.7.23 version on RHEL/CentOS 7/6/5 and Fedora 23/22/21 using MySQL Yum repository via YUM utility.

Step 1: Adding the MySQL Yum Repository 

  • We will use official MySQL Yum software repository, which will provides RPM packages for installing the latest version of MySQL  server, client, MySQL Utilities, MySQL Workbench, Connector/ODBC, and Connector/Python for the RHEL/CentOS 7/6/5 and Fedora 23-21.
  • Now download and add the following MySQL Yum repository to your respective Linux distribution system’s repository list to install the latest version of MySQL.

            ----------------------------------On RHEL/CentOS 7 ----------------------------------------------------------------
             #  wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
            ----------------------------------On RHEL/CentOS 6 ----------------------------------------------------------------
            # wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
            ----------------------------------On RHEL/CentOS 5 ----------------------------------------------------------------
           # wget http://dev.mysql.com/get/mysql57-community-release-el5-7.noarch.rpm
  • After downloading the package for your Linux platform, now install the downloaded package with the following command.

               --------------------------------On RHEL/CentOS 7 ----------------------------------------
               # yum localinstall mysql57-community-release-el7-7.noarch.rpm
              -------------------------------- On RHEL/CentOS 6 ----------------------------------------
               # yum localinstall mysql57-community-release-el6-7.noarch.rpm
              ---------------------------------On RHEL/CentOS 5 ----------------------------------------
               # yum localinstall mysql57-community-release-el5-7.noarch.rpm

  • The above installation command adds the MySQL Yum repository to system’s repository list and downloads the GnuPG key to verify the integrity of the packages.
  • You can verify that the MySQL Yum repository has been added successfully by using following command.           
         # yum repolist enabled | grep "mysql.*-community.*"

Step 2: Installing Latest MySQL Version
  • Install  version of MySQL (currently 5.7) using the following command.
         # yum install mysql-community-server
  • The above command installs all the needed packages for MySQL server mysql-community-server, mysql-community-client, mysql-community-common and mysql-community-libs.

Step 3: Installing MySQL Release Series

  • You can also install different MySQL version using different sub-repositories of MySQL Community Server. The sub-repository for the recent MySQL series (currently MySQL 5.7) is activated by default, and the sub-repositories for all other versions (for example, the MySQL 5.6 or 5.5 series) are deactivated by default.
  • To install specific version from specific sub-repository, you can use --enableor --disableoptions using yum-config-manager or dnf config-manager as shown:
        # yum-config-manager --disable mysql57-community
        # yum-config-manager --enable mysql56-community

Step 4: Starting the MySQL Server

  • After successful installation of MySQL, it’s time to start the MySQL server with the following command:             
       # service mysqld start
  • You can verify the status of the MySQL server with the help of following command.     
       # service mysqld status

Output Sample of running MySQL :

  • Now finally verify the installed MySQL version using following command.           
       # mysql –version

Output Sample:
mysql  Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using  EditLine wrapper

Step 5: Securing the MySQL Installation
The command mysql_secure_installation allows you to secure your MySQL installation by performing important settings like setting the root password, removing anonymous users, removing root login, and so on.

Note: MySQL version 5.7 or higher generates a temporary random password in /var/log/mysqld.logafter installation.

Use below command to see the password before running mysql secure command.
            # grep 'temporary password' /var/log/mysqld.log
Once you know the password you can now run following command to secure your MySQL installation.
            # mysql_secure_installation

Note: Enter new Root password means your temporary password from file /var/log/mysqld.log.
Now follow the onscreen instructions carefully, for reference see the output of the above command below.

Output Sample:
Enter password for user root:
Enter New Root Password
VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy: LOW Length >= 8MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary  file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Using existing password for root.
Estimated strength of the password: 50
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password: Set New MySQL Password
Re-enter new password: Re-enter New MySQL Password
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother.You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.

- Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

Step 6: Connecting to MySQL Server
Connecting to newly installed MySQL server by providing username and password.
 # mysql -u root -p 

Sample Output:

Step 7: Updating MySQL with Yum

Besides fresh installation, you can also do updates for MySQL products and components with the help of following command.
           # yum update mysql-server
That’s it, you’ve successfully installed MySQL 5.7.23 on your system.
--------------------------------------------------------------------------------------------------------------------------
Note: 
Install only when you are in need of mysql – connector-java
- yum install mysql-connector-java

To Uninstall MYSQL:

yum remove mysql
yum remove mysql-server
yum clean all
yum remove mysql55-libs


Thanks,
Have Fun!!!!

Please Leave your Comment Below If you Have Any Clarifications Regarding Installations or Any Suggestions.

Comments

Popular posts from this blog

Quick Setup Steps For Installing & Integrating Spark,Hive,Hadoop Processess Together !!!

Twitter Analysis Using R

Best Practices for Apache Hive Performance Tuning

Performance Improvement in Hive (Properties in HIVE -SITE.XML)

Installation Steps for Hive

Facebook Data Analysis Using R

Installation Steps For Spark