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

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

[[email protected] ~]# grep password /var/log/mysqld.log
2019-08-08T08:29:02.094554Z 1 [Note] A temporary password is generated for [email protected]: 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)


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

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

» 订阅本站:https://blog.java-zone.org/feed/

标签: MySQL

添加新评论