- Stop MySQL: sudo /etc/init.d/mysql start or mysql start
- Restart it manually with the skip-grant-tables option:
mysqld_safe --skip-grant-tables
- Run the MySQL client:
mysql -u root
- Reset the root password manually with this MySQL command:
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
- Flush the privileges with this MySQL command:
FLUSH PRIVILEGES;
(Maybe this isn't what you need, Abs, but I figure it could be useful for people stumbling across this question in the future)
source: http://stackoverflow.com/questions/489119/mysql-error-1045-access-denied