Mysql密碼設置

在使用MySQL時,出現了這樣的錯誤提示:html

you must reset your password using alter,讓重設密碼。mysql

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來延長使用期限
或者sql

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命令了~spa

clipboard.png

相關文章:
ALTER USER Syntax3d

相關文章
相關標籤/搜索