:You must reset your password using ALTER USER statement before executing this statement.
--alter user 'root'@'localhost' identified by '123456';
D:\ProgramData\MySQL\MySQL Server 5.7\my.ini,最后面加上skip-grant-tables,重启mysql服务
update mysql.user set authentication_string=password('root'),password_last_changed = NOW() where user='root';
update mysql.user set password_expired='N' where user='root';
flush privileges;
在my.ini最后skip-grant-tables,加上#屏蔽。
重启mysql服务
mysql5.0:
update user set password=password("new_pass") where user="root";