Loosing your root password on a MySQLserver could become tricky.
If you face this situation, you will have to stop your MySQL server
#/etc/init.d/mysql stop
One your database is stopped, you will start it again with 2 options to avoir authentication process but also avoid networtking connection to your unsecure database:
#/usr/libexec/mysqld --skip-grant-tables --skip-networking &
you will now be able to connect without password:
#mysql mysql -u root
One you are connected, you can reset your password and flush the privileges to apply changes on database:
MYSQL> UPDATE user SET password=PASSWORD('newpassword') WHERE user='root';
MYSQL>FLUSH PRIVILEGES;
MYSQL>quit;
Then restart mysql:
#/etc/init.d/mysql restart
And start using KeePass software to store your password !