Reset MySQL root password

Stop mysqld and restart it with the –skip-grant-tables option. This enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to use –skip-grant-tables in conjunction with –skip-networking to prevent remote clients from connecting.

Connect to the mysqld server with this command:

shell> mysql

Issue the following statements in the mysql client. Replace the password with the password that you want to use.

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

The FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.