Troubleshooting MySQL Root Access Denied Using Password Yes/No on Linux/Unix

March 9th, 2014 by thelinuxevangelist

Solve: MySQL root Access Denied Using Password Yes/No




The Post Presents a Quick Troubleshooting for MySQL Unable to Login as the Root User on Linux/Unix.

Included Link with the Recommended MySQL Database Secure Installation

Troubleshooting MySQL Root Access Denied Using Password Yes - Featured
  • Check if MySQL Installer has Set a Random Password

    sudo cat /root/.mysql_secret

    Or in Installations by Rpm Installer:

    sudo grep 'temporary password' /var/log/mysqld.log

    If Got “User is Not in Sudoers file” then Look: Solution

    Eventually Check also in your User Home

    If Found then Try this Password to Login!

  • Recommended MySQL Server Database Secure SetUp:

    MySQL Secure Database SetUp
  • Else Reset the MysQL root Pass

    1. Check if MySQL is Already Started

      Find mysqld PID

      ps ax | grep mysqld

      Log-In as Super-User with:

      sudo su

      Or:

      su -

      If MySQL is Started then Kill mysqld with:

      pkill mysqld

      Or:

      kill -9 [PID]

      In Ubuntu/Debian Based also:

      service mysql stop
    2. Start MySQL Server in Recovery Mode

      mysqld_safe --skip-grant-tables --skip-networking &

      If No mysqld_safe because MySQL 5.7.6+ & systemd

      Get MySQL Pass Reset for MySQL 5.7.6+



    3. Then You Can Safely Reset MySQL root Pass

      mysql -u root
      use mysql;
      UPDATE user SET Password=PASSWORD("[newPass]") WHERE User="root";
      exit

      Then You should be Able to Login as root into MySQL!

(Visited 1 times, 1 visits today)
Share on Tumblr

Tags: , , , , , ,


Comments are disabled