MySQL 8.0 修改用户密码

in mysql80 •  6 years ago 

   MySQL 8.0 在 CentOS 7完成安装后,在 Linux 命令行执行 sudo grep 'temporary password' /var/log/mysqld.log ,获取 mysql 的临时密码。

  1. mysql -uroot -p <temporary password>,本地命令行登录 MySQL;
  2. use mysql,进入 MySQL 数据库;
  3. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码',使用 ALTER USER修改密码;
  4. 退出,使用新密码登录。
注意: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      |

+--------------------------------------+--------+

修改密码时,也需要满足此要求。
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @jpory! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @jpory! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

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!