mysql-5.7密码


mysql5.7后,默认会初始化一个随机密码在日志文件中。

1.默认随机密码会过期,提示如下

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

解决办法:

2.SET PASSWORD = PASSWORD(your new password);

3. ALTER USER root@localhost PASSWORD EXPIRE NEVER;

4.flush privileges;