How to Install Latest MySQL 5.7.9 on RHEL/CentOS 7/6/5 and Fedora 23/22/21

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

87 Responses

  1. Vincent says:

    I followed your instructions and was able to installed MySQL 5.7 successfully on RHEL 7.2 Server. I tried to restore my backup database from MySQL 5.0.95 and got error messages:

    Full database restore:
    ERROR 1067 (42000) at line 18172: Invalid default value for ‘modified’

    SQL restore:
    ERROR 1146 (42S02) at line 72: Table ‘mysql.proc’ doesn’t exist

    Are there any other steps to be done before these database restored? I heard the MySQL 5.7 is downward compatible with older version.

    Thank you.

    • Ravi Saive says:


      This is due to sql_modes, please check your existing sql_modes using following command.

      show variables like 'sql_mode' ; 

      And delete the sql_modeNO_ZERO_IN_DATE,NO_ZERO_DATE” to make it work.

      This is the default sql_mode in mysql new versions.

      • Vincent says:

        Ravi – I modified the my.cnf file under /etc directory like the way you recommended and restart the system again.

        Check to see if my.cnf is working:

        mysql> show variables like 'sql_mode';
        | Variable_name | Value                                  |
        | sql_mode      | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,|
        1 row in set (0.00 sec)

        Restore the backup file again and got this error:

        [[email protected] Gelbray]# mysql -u root -p < mysqldbs.2016-10-03.gelbray.sql
        Enter password: 
        ERROR 1146 (42S02) at line 12621: Table 'mysql.proc' doesn't exist
        [[email protected] Gelbray]# 

        Can you tell what cause of this problem?

  2. Anne Shanks says:

    Thanks for this. It was very helpful to me. I followed these instructions installed and secured then discovered that:


    Is -9 better? I am on an enterprise RehHat Rhel6 server and not very mysql experienced.

    yum update mysql-server say "not Installed"  

    Does not see the community editions repo sees our subscription satellite Server repo.

    Maybe this will work

    redscarf # yum update  mysql-community-server.x86_64

    say no updates available does not say “available but not installed”

    I had previously downloaded mysql57-community-release-el6-9.noarch.rpm from the oracle support site but was having trouble getting install steps.

    Seems that is identical to what you get with:


    It was download from here, browser because I had to login to Oracle support with my work support ID to get that download.

    I guess I should uninstall that -7 and try the -9?

    MY rhel 6 enterprise severs have

    myhost # mysql --version
    mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
    myhost # cat /etc/redhat-release
    Red Hat Enterprise Linux Server release 6.8 (Santiago)
  3. Jayaprakash Singamsetty says:

    I am planning to upgrade Mysql 5.5 to 5.7 in my RHEL machine, I have application running on it after upgrade i can’t able to see the application connecting to application..

  4. Doug Marshall says:

    No clue what is happening. It can’t find the sock and I can’t start it. I either get that error or MySQL Daemon failed to start

    And I can’t find mysql.sock either

    • Ravi Saive says:


      Find the mysql.sock location with the help of following command:

      # find / -type s | grep mysqld.sock

      Next remove the mysql.sock and restart the service as shown:

      # service mysqld stop
      # rm -rf /var/lib/mysql/*
      # service mysqld start
      # mysql_secure_installation
  5. Rufus says:

    nice documented and easily understand, thank you very much

  6. Debbie Lawton says:

    MySQL is a prereq for RTM (IBM product) and I see in the rtm conf it is looking for the /etc/init.d/mysqld. I have the SQL started (THANK YOU for your wonderful guide) and am seeing expected results but am not sure why the /etc/init.d/mysqld is not starting.

  7. Yusuf says:

    Quite helpful

  8. meet vora says:

    very well documented and easily understandable for beginners, thank you very much for wonderful tutorial

  9. ams-jamali says:

    installed Mysql but resceived error;
    [[email protected] ~]# service mysqld status
    mysqld (pid 327) is running…
    [[email protected] ~]# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 24
    Server version: 5.7.13

    Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective

    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

    mysql> show databases;
    ERROR 1820 (HY000): Unknown error 1820

    How to solve?

    • Ravi Saive says:


      MySQL 5.6 added one strong feature is auto encrypted password creation when mysql first time installed on Linux box and you can find the password in mysql error log file, located at /var/log/mysqld.log. Once you are connected to mysql using encrypted password you will get such error until unless mysql root password is reset again.

      mysql> SET PASSWORD = PASSWORD('new_password');
      mysql> use mysql;
      mysql> show databases;
  1. October 5, 2016

    […] Install Latest MySQL Database in Linux Systems […]

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *