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

March 9, 2014 | By the+gnu+linux+evangelist.

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.

Step-by-step MySQL Workbench Manjaro 18 GNU/Linux Installation Guide
  • 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 see: How to Enable sudo

    Possibly 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


      su -

      If MySQL is Started then Kill mysqld with:

      pkill mysqld


      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

      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";

      Then you should be able to Login as root into MySQL!

QuickChic Theme • Powered by WordPress