Ok, if this is your only problem this little trick will show how to recover your root password.
Proceed as follows.
- Stop the db engine
- Restart the daemon
/usr/bin/mysqld_safe –skip-grant-tables &
- Go to the MySQL interactive command
mysql -h your_hostname mysql
- Change the password with the GRANT command
GRANT ALL PRIVILEGES ON * to root@localhost IDENTIFIED BY ‘passwd’;
Maybe it should be better to flush privileges from mysqladmin:
mysqladmin -h localhost flush-privileges
That’s it. Now try to login as usual.