i have also faced this thing i actually forgot the root user password of my sql command line i have tried this using several ways in which the instructions are like stopping the MySQL and then passing some query but it didn't work for me so this is what worked for me
open the MySQL installer and then u will saw there are i MySQL installer and 2 shortcut for shell and command line now uninstall the shortcut and
then again reopen the installer here u can reinstall the MySQL completely and then
u can set the new password for the root user in MySQL
so u don't need to do this hard work of running the command