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.
![How to Reset the MySQL 5.7.6+ Root Password without mysqld_safe - Featured](https://tutorialforlinux.com/wp-content/media/dg139/intro/gnomePenguinBallMySQL.jpg)
-
Stop MySQL Service:
sudo systemctl stop mysqld
-
Set the MySQL Env Option –skip-grant-tables.
sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
-
Start MySQL with –skip-grant-tables.
systemctl start mysqld
-
Login as MySQL Root.
mysql -uroot
-
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
-
Stop MySQL Server.
sudo systemctl stop mysqld
-
Unset the MySQL Env Option –skip-grant-tables.
sudo systemctl unset-environment MYSQLD_OPTS
-
Restart MySQL Server.
sudo systemctl start mysqld
-
Then you should be Able to Login into MySQL as Root :)
mysql -uroot -p