打开mysql数据库小黑屏
然后输入
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '123456'; //‘123456’为新密码
Query OK, 0 rows affected (0.10 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
即可重新登录。
原文:https://blog.csdn.net/u012965373/article/details/81206241