MySQL 8.0 在 CentOS 7完成安装后,在 Linux 命令行执行 sudo grep 'temporary password' /var/log/mysqld.log
,获取 mysql 的临时密码。
mysql -uroot -p <temporary password>
,本地命令行登录 MySQL;use mysql
,进入 MySQL 数据库;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码'
,使用 ALTER USER修改密码;- 退出,使用新密码登录。
注意:MySQL 8.0 有内置的密码复杂度规则,可以使用 mysql> SHOW VARIABLES LIKE 'validate_password%';
查看,其默认的规则如下图:
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 8 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | MEDIUM |
| validate_password.special_char_count | 1 |
+--------------------------------------+--------+
修改密码时,也需要满足此要求。
Congratulations @jpory! You have received a personal award!
1 Year on Steemit
Click on the badge to view your Board of Honor.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @jpory! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit