mysql8.0修改root用户密码
MUKE
这个人很懒,什么都没有留下。
MUKE
2023-04-18 10:40:30
480
{{single.collect_count}}

但是MySQL8之后,没有了password字段和password()函数,所以不能使用上面的修改密码的方法。
MySQL8应该使用alter命令来进行修改,而且由于密码策略也变化了,设置密码时需要达到一定的复杂程度才行,一般是需要大小字母、特殊字符和数字。

# 登录MySQL
>mysql -uroot -proot
>use mysql;
>alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.15 sec)
>flush privileges;
Query OK, 0 rows affected (0.04 sec)
# 退出重新登录
>mysql -uroot -p123456
>
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}