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 7, 2016 | By the+gnu+linux+evangelist.

Resetting the MySQL Root Pass on Systems with systemd

You are Welcome, 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 Install MySQL Workbench on Ubuntu 24.04 – Step-by-step
  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> 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

QuickChic Theme • Powered by WordPress