How-to Reset the MySQL 5.7.6+ Root Password without mysqld_safe in Fedora / CentOS / Red-Hat / Oracle / SUSE / OpenSUSE Linux Easy Guide

March 7th, 2016 by thelinuxevangelist

Resetting the MySQL Root Pass on Systems with systemd




Hello Linux User, this Tip Shows You Step-by-Step How-to Reset the MySQL 5.7.6+ Root Password without mysqld_safe in Fedora/CentOS/Red-Hat/Oracle/SUSE/OpenSUSE Linux.

As of MySQL 5.7.6+, if you install MySQL using an RPM distribution on the following Linux platforms, server startup and shutdown is managed by systemd.

How-to Reset the MySQL 5.7.6+ Root Password without mysqld_safe - Featured
  1. Stop MySQL Service:

    sudo systemctl stop mysqld
  2. Set the MySQL Env Option –skip-grant-tables

    sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
  3. Start MySQL with –skip-grant-tables

    systemctl start mysqld
  4. Login as MySQL Root

    mysql -uroot
  5. Updating MySQL Root Password

    mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPassword')
       -> WHERE User = 'root' AND Host = 'localhost';
    

    Set an Enough Complex MySQL Pass at least 8 Characters Long and with Numbers + Uppercase + Lowercase…

    mysql> FLUSH PRIVILEGES;
    mysql> quit
  6. Stop MySQL Server

    sudo systemctl stop mysqld
  7. Unset the MySQL Env Option –skip-grant-tables

    sudo systemctl unset-environment MYSQLD_OPTS
  8. Restart MySQL Server

    sudo systemctl start mysqld



  9. Then You should be Able to Login into MySQL as Root :)

    mysql -uroot -p

Tanks to Kevi Jones

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

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,


Comments are disabled