Recover the root password
Due to the way MySQL encrypts passwords it is not possible to recover one, There is however a way of resetting one. Here is how to do it for the root user…
at a command prompt type…
sudo service mysqld stopsudo mysqld_safe --skip-grant-tables &sudo mysql
then in MySQLUPDATE mysql.user SET password=PASSWORD('new-password') WHERE user='root';FLUSH PRIVILEGES;EXIT;mysqladmin -u root -p shutdown
You will be asked for the root password that you have just setsudo service mysqld start
That's all folks!