Accidentally forgot the password. .
First follow this article https://blog.csdn.net/coder_jeremy/article/details/73928028
Up to this point:
Change the root password with the command: UPDATE user SET Password=PASSWORD( 'new password') where USER= 'root';
After MySQL was upgraded, the field name was changed, and the password name was changed to authentication_string, so it was changed to
UPDATE user SET authentication_string=PASSWORD('新密码') where USER='root'