MySQL5.7初始化密码修改(ERROR 1820 (HY000): You must reset your password using ALTER USER statement before)

1、MySQL5.6是密码为空直接进入数据库的,但是MySQL5.7就需要初始密码

[root@iZbp149bi4xruwysa2vsi9Z ~]# grep password /var/log/mysqld.log
2019-08-08T08:29:02.094554Z 1 [Note] A temporary password is generated for root@localhost: 7P4gwekD2r+Y

2、然后执行mysql -uroot -p,输入上面的到的密码进入,用该密码登录后,必须马上修改新的密码,不然会报如下错误:

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

3、修改密码

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


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

《CentOS7服务器Yum安装MySQL5.7》


» 本文链接:https://blog.apires.cn/archives/1100.html
» 转载请注明来源:Java地带  » 《MySQL5.7初始化密码修改(ERROR 1820 (HY000): You must reset your password using ALTER USER statement before)》

» 本文章为Java地带整理创作,欢迎转载!转载请注明本文地址,谢谢!
» 部分内容收集整理自网络,如有侵权请联系我删除!

» 订阅本站:https://blog.apires.cn/feed/

标签: MySQL

添加新评论