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’

[cc lang=”sql”]UPDATE mysql.user SET Password=PASSWORD(‘whatever’) WHERE User=’root’; FLUSH PRIVILEGES;[/cc]

Press Go and you should get this screen:

Continue reading