Just had a need to reset the mysql root login password for a server, did a bit of Googling and found out this is how you do it (I work on Ubuntu so you may have to tinker with the lines slightly depending on your distribution):
- Stop the current MySQL instance from running:
 /etc/init.d/mysql stop
- Run mysql with –skip-grant-tables
 /usr/bin/mysqld_safe –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysqld.pid –socket=/var/run/mysqld/mysqld.sock –port=3306 –skip-grant-tables &
- Log into mysql, straight into the mysql database
 mysql -u root mysql
- Reset the root password.
 UPDATE user SET Password=PASSWORD(‘newrootpassword’) WHERE User=’root’;
- Flush privileges
 flush privileges;
- Shut down the new running mysql.
 /etc/init.d/mysql stop
- Start up mysql as usual.
 /etc/init.d/mysql start
Et voila, you now have a new root password without needing to know the old one!

