ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)


sudo mysql -u root

and if you get error – like below

ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)


then use mysql -u root -p


mysql -u root -p 

mysql> use mysql;



mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘NewPassword’;

mysql> flush privileges;

mysql> exit;

Leave a Comment

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