Reset the root password on MySQL
Yes, it really is this easy.run the following command to change the mysql root password
sudo /etc/init.d/mysql reset-password
New MySQL root password:
Setting new MySQL root password
But how? Debian (and by inheritance, Ubuntu) have a special user called ‘debian-sys-maint' on each mysql install that has admin privileges on the server. It's used to shutdown the server gracefully, automatically check for corrupt tables, and resetting your password. Its password is randomly generated, and stored in /etc/mysql/debian.cnf. Handy if you want to do some admin scripts yourself.