登录
首页 >  数据库 >  MySQL

Mysql密码设置

来源:SegmentFault

时间:2023-02-16 15:34:37 322浏览 收藏

哈喽!今天心血来潮给大家带来了《Mysql密码设置》,想必大家应该对数据库都不陌生吧,那么阅读本文就都不会很困难,以下内容主要涉及到MySQL,若是你正在学习数据库,千万别错过这篇文章~希望能帮助到你!

在使用MySQL时,出现了这样的错误提示:

you must reset your password using alter
,让重设密码。

clipboard.png

D:\xampps> mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.7.9

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql 5.7增加了两个字段password_last_changed、password_lifetime来完善安全策略。
fault_password_lifetime来延长使用期限
或者

ALTER USER 'root'@localhost' PASSWORD EXPIRE INTERVAL 90 DAYS;
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'localhost' PASSWORD EXPIRE DEFAULT;

可以使用下面的语法进行权限设置:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '518666' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)

设置成功之后,可以成功使用

use mysql
命令了~

clipboard.png

相关文章:
ALTER USER Syntax

今天带大家了解了MySQL的相关知识,希望对你有所帮助;关于数据库的技术知识我们会一点点深入介绍,欢迎大家关注golang学习网公众号,一起学习编程~

声明:本文转载于:SegmentFault 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>
评论列表