- Stop the mysql service or process
- Connect to the mysql server and execute the following SQL statements:
UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE User='root';
FLUSH PRIVILEGES;
The UPDATE statement resets the password for all root accounts and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.
- Stop the server and restart it normally. Now you should be able to connect to the MySQL server as root using the new password.