重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2168|回复: 1
打印 上一主题 下一主题

root用户修改其他用户的密码

[复制链接]
跳转到指定楼层
楼主
发表于 2014-11-20 19:35:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

比如一个用户sztech1,用户密码忘了,如何修改呢

 

我们可以使用root用户登录,

然后进行修改,具体为:

 

 

# mysql -uroot -p

 

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.21-log MySQL Community Server (GPL)

Copyright (c) 2000, 2014, 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数据库

 

root@localhost [(none)]>use mysql


Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

 

修改sztech1的密码

 

root@localhost [mysql]>update user set password=password("sztech") where user='sztech1';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

 

注意,sztech1是区分大小写的。

 

之后,sztech1就可以登录了。

 

 

 

 

 

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

沙发
 楼主| 发表于 2014-11-21 09:55:39 | 只看该作者

注意,修改后,必须要:

 

root@localhost [(none)]>flush privileges;
Query OK, 0 rows affected (0.00 sec)

 

,否则,不会马上生效。

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-6 16:16 , Processed in 0.092728 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表