Error

$ mysql -u root
 Error 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Stop mysqld deamons

$ sudo service mysql stop

Start a mysql deamon with the –skip-grant-table option

$ sudo mysqld_safe --skip-grant-tables

Open a separate terminal and and run the following commands

$ mysql
 mysql> use mysql;
 mysql> UPDATE user SET password=PASSWORD('YOUR_NEW_PASSWORD_HERE') WHERE user = 'root';
 mysql> exit;

Kill the mysqld_safe process and restart mysqld

$ sudo service mysql restart

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.