Change MySQL root password
Tagged:

Open the command line, navigate to the directory where MySQL is installed. Further, navigate to the directory 'bin' inside the MySQL directory (in my case, the directory structure is C:\mysql\bin> ) and open MySQL console by entering following command.

You will be prompted to enter a password for root user. Enter the password or leave it blank in case there's no password set.

C:\mysql\bin>mysql -u root -p
Enter Password:

Next enter the command below in your MySQL console to change your root password.

mysql>set password=password('NEWPASSWORD');

ALTERNATIVE METHOD:
Repeat the steps above to open the MySQL console and follow these steps.
Use the database mysql.

mysql>USE mysql;

Update the user table and set the new password to the user root

mysql>UPDATE user SET password=password(’newrootpassword’) WHERE user=’root’;

NOTE: This method requires the mysql service to be restarted for the changes to take effect.