How to set/reset MySQL root password?

I am using XAMPP to run Apache server with PHP and MySQL. As you install XAMPP it set the MySQL password to empty by default. To change the password you can navigate to http://localhost/phpmyadmin (remember to include your port if you had to use a different port number than 80). Then click on SQL and enter the following query to reset the password to ‘whatever’

UPDATE mysql.USER SET Password=PASSWORD('whatever') WHERE USER='root'; FLUSH PRIVILEGES;

Press Go and you should get this screen:

Continue reading