小樱知识 > 生活常识 > 怎样修改密码(又忘记密码啦?)

怎样修改密码(又忘记密码啦?)

提问时间:2022-08-09 13:16:28来源:小樱知识网


使用mysqladmin修改密码

使用mysqladmin命令将帐户密码格式更改为mysqladmin -u username -p旧密码新密码。

[root@host ~]# mysqladmin -utestuser -pPassword2 password Password3mysqladmin: [Warning] Using a password on the command line interface can be insecure.Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.[root@host ~]# mysql -utestuser -pPassword3mysql: [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 2388Server version: 5.7.23-log MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement.mysql>

直接更新用户表

实际上,MySQL的所有账户信息都存储在mysql.user表中,我们也可以通过update user表直接更改密码。

# 5.7及之后版本mysql> update mysql.user set authentication_string = password (\'Password4\') where user = \'testuser\' and host = \'%\';Query OK, 1 row affected, 1 warning (0.06 sec)Rows matched: 1  Changed: 1  Warnings: 1

以上内容就是为大家推荐的怎样修改密码(又忘记密码啦?)最佳回答,如果还想搜索其他问题,请收藏本网站或点击搜索更多问题

内容来源于网络仅供参考
二维码

扫一扫关注我们

版权声明:所有来源标注为小樱知识网www.cnfyy.com的内容版权均为本站所有,若您需要引用、转载,只需要注明来源及原文链接即可。

本文标题:怎样修改密码(又忘记密码啦?)

本文地址:https://www.cnfyy.com/shcs/619727.html

相关文章