比如一个用户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就可以登录了。
注意,修改后,必须要:
root@localhost [(none)]>flush privileges;
Query OK, 0 rows affected (0.00 sec)
,否则,不会马上生效。
欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) | Powered by Discuz! X3.2 |