If … Mysql forget root password

go to the Path of mysql’s config directory



or if you are using bitnami


vim mysqld.cnf   (my.cnf)

under [mysqld]



Now log in to mysql that do not need password, change password for root, e.g.

use mysql

mysql>update user set password=password('newpassword') where user= 'root';

mysql>flush privileges;

difficulty encountered

in bitnami, mysql database’s user table do NOT have column ‘password’, instead it has, ‘authentication_string’ for the password column, so:

mysql>update user set authentication_string=password('newpassword') where user= 'root';

mysql>flush privileges;

password(‘string’), is a function that encrypt the string to safer representation.

then go back to mysql config file and delete  skip-grant-tables

restart mysql