Reset the Password of MySQL in Linux

If you had forgot the password of MySQl in your Linux System, you can always reset it. Usually, you would get the 1025 (28000) error message if you entered a wrong password or forgot to enter one.

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

The following steps will help you to change you password. Use need to login as root (superuser) to do this.

service mysql stop

mysqld_safe –skip-grant-tables

mysql –user=root mysql

update user set Password=PASSWORD(‘new-password’) where user=’root’;
  flush privileges;