Losing your password sucks especially when it’s the root password for your MySQL database.
Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Here’s a convenient way to reset your root password when you lose it.
/usr/local/mysql/bin/mysqladmin -u root -p password
The command line will give you a similar question:
Don’t add anything and you will push asked for your new password:
New password: Confirm new password:
Voila! Your MySQL root password has been reset!
While it is easy to reset your root password, unless of course it’s a development machine, it not recommended that you use your root account for menial purposes.