MySQL Root Password reset

There are loads of ways to reset a forgotten MySQL root password. Here is my favourite method.

Log into the server

Elevate to root run the command below (the & is important):

service mysql stop

mysqld_safe –skip-grant-tables &

Press enter

Now type: mysql -uroot

Use the following statements to reset the password to changeme

use mysql;

update user set password=PASSWORD(“changeme”) where User=’root’;

flush privileges;



Finally type

service mysql start

The password has been reset. Ensure you change it if you used the example above rather than setting your own.