How to Reset the Root Password in MySql Database

Run the following commands separately to change/reset your ‘root’ user password in MySql database.

There is a database called mysqlwhich is the default database. It is where Users such as root are stored. More info can be found
In this script, it is assumed that your new password is MyNewPassword. Hence, replace that with whatever you want your password to be.

UPDATE mysql.user
SET Password=PASSWORD(‘MyNewPassword’)
WHERE User=’root’;

Originally published at