mysql报错ERROR 1820ALTER USER statement before executing this statement的解决办法

破解完mysql密码,使用新密码成功登陆进行授权操作的时候提示如下报错:

mysql> grant all privileges on . to 'root'@'%' identified by 'Data123';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

初步分析应该是密码过期导致,下面附上解决办法

重新登陆数据库使用alter修改密码

mysql> alter user 'root'@'localhost' identified by 'Data123';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'root'@'%' identified by 'Data123';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)

修改完密码在重新授权的时候成功解决

发表评论

后才能评论