Thursday, July 14, 2016

How to reset MySQL root password from MySQL CLI

Here's how to reset MySQL root password from command line


Login to mysql via command line and then run flush privileges command like this:
FLUSH PRIVILEGES;
Then change the 'root'@'localhost' account password. Replace the password with the password that you want to use. To change the password for a root account with a different host name part, modify the instructions to use that host name.

MySQL 5.7.6 and later:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

Source : http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

No comments:

Post a Comment