SET PASSWORD FOR 'root'@'localhost' = PASSWORD('NEW_PASSWORD');

And if you’ve forgotten the password, do the following:

sudo su -
service mysql stop
service mysql start --skip-grant-tables
mysql
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEW_PASSWORD';

 

Advertisements