It is not possible to recover a lost Mysql password since they are encrypted. But it can always be changed or reset.

To change the root Mysql password, follow these steps (they are primarily listed to use in our VPS servers but they may be used in others as well):

1) Stop mysql by executing as root in the command line: service mysql stop

2) Start mysql without the privileges system, execute: mysqld_safe –skip-grant-tables &

3) Open the mysql console by executing: mysql

4) Run the following queries (replace the root password with your desired password)

UPDATE mysql.user SET Password=PASSWORD(‘yourpassword’) WHERE User=’root’;
FLUSH PRIVILEGES;

5) exit the mysql console and stop mysql: service mysql stop

6) Start mysql by executing: service mysql start

Now the new password is in place.