MySQL 错误:ERROR 1820 (HY000)

疑难杂症  

 MySQL 在安装完成之后,会初始化一个密码,用初始化密码登录后,需要重新设置密码才能执行命令。如果未进行密码修改,执行命令会报以下错误。

      ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

  执行如下修改密码命令,依旧报错:

update  mysql.user set authentication_string = password ('rootroot') where user= 'root' ; 

alter  user 'root'@'localhost' identified by 'rootroot';

grant all privileges on *.* to root@'%' identified by 'rootroot';

flush privileges;  

需要执行以下命令方可成功:

set password= password('rootroot');

flush privileges;