We can chhange the MYSQL root password using the below statement:
?ALTER?USER?'root'@'localhost'?IDENTIFIED?BY?'NewPassword';?
?
Next, open a Command Prompt and navigate to the MySQL directory. Now, copy the following folder and paste it in our DOS command and press the Enter key.
C:\Users\devsqna>?CD?C:\Program?Files\MySQL\MySQL?Server?8.0\bin?
?
Next, enter this statement to change the password:
mysqld?--init-file=C:\\mysql-notepadfile.txt??
?
Finally we login our MYSQL root server using new password.