Stop mysql
service mysql stopStart the mysqld demon process using the --skip-grant-tables option with this command
/usr/sbin/mysqld --skip-grant-tables --skip-networking &Connect as root without password
mysql -u rootFrom the mysql prompt execute this command to be able to change any password
FLUSH PRIVILEGES;Then reset/update your password
SET PASSWORD FOR root@'localhost' = PASSWORD('password');Or
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';Or
USE mysql
UPDATE user SET Password = PASSWORD('newpwd')
WHERE Host = 'localhost' AND User = 'root';Or
USE mysql
UPDATE user SET Password = PASSWORD('newpwd')
WHERE Host = '%' AND User = 'root';Do again
FLUSH PRIVILEGES;Then stop the mysqld process and relaunch it with the classical way:
service mysql stop
service mysql start