Reset MySQL root password

Have you lost your MySQL root password?? Oh… That sucks!

Here his how to change it (on *nix):

# /etc/init.d/mysql stop
# mysqld_safe --skip-grant-tables &;
# mysql -u root mysql
> UPDATE user SET Password=PASSWORD('newrootpassword') WHERE User='root';
> FLUSH PRIVILEGES;
> exit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
In order to use Disqus to comment out you have to accept the use of third-party cookies.