Unable to access MySQL console as ROOT due to lost and/or unknown password.
Attempted to reset the password by following the below KB article, however, it appears not working with MySQL 8.x version.
https://knowledge.broadcom.com/external/article/92946/how-to-reset-mysql-internal-root-passwor.html
Release : 10.0
Component :
The procedure to reset DB Root password is slightly different in MySQL 8.x from what used to be in MySQL 5.x.
Start MySQL service with the --skip-grant-tables option and alter the ROOT password with the following steps:
# systemctl stop mysqld.service
# mysqld --skip-grant-tables --user=mysql &
# mysql
# FLUSH PRIVILEGES;
# ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
Need to kill mysql process it was not started as a service
# cd /var/run/mysqld
# kill `cat /var/run/mysqld/mysqld.pid`
# systemctl start mysqld.service
Please, do not forget to update /root/.my.cnf file with the new password if you store it under the OS user profile.
Also after this command make sure mysql stopped
# systemctl stop mysqld.service
If not kill is
# ps -ef | grep mysql
mysql 21710 21649 0 11:02 pts/0 00:00:03 mysqld --skip-grant-tables --user=mysql
Then # systemctl start mysqld.service