I can log in to MySQL through Navicat Premium, but the root user password is forgotten

I have been using this computer for a long time, but I forgot the mysql password. Method: Edit the user table directly with UPDATE

  mysql -u root

  mysql> use mysql;

  mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';

  mysql> FLUSH PRIVILEGES;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326391418&siteId=291194637