MySQL 5.6
不校验授权的方式打开MySQL进程
service mysqld start --skip-grant-tables &
重新设置新密码
update mysql.user set password=PASSWORD(‘newpassword’) where User=‘root’;
// 赋值粘贴后需要更改单引号为正确格式再运行
详细原文: https://www.cnblogs.com/hgj123/p/5279471.html
MySQL 5.7
update mysql.user set authentication_string=PASSWORD(‘newpassword’) where User=‘root’;