打赏 jQuery火箭图标返回顶部代码

MySQL忘记密码怎么重置

1打开mysql.exe和mysqld.exe所在的文件夹,复制路径地址

输入命令  mysqld --skip-grant-tables  回车,此时就跳过了mysql的用户验证。注意输入此命令之后命令行就无法操作了,此时可以再打开一个新的命令行。注意:在输入此命令之前先在任务管理器中结束mysqld.exe进程,确保mysql服务器端已结束运行。

 

 输入mysql登陆

 1 C:\Users\Administrator>mysql
 2 Welcome to the MySQL monitor.  Commands end with ; or \g.
 3 Your MySQL connection id is 3
 4 Server version: 5.5.40 MySQL Community Server (GPL)
 5 Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
 6 Oracle is a registered trademark of Oracle Corporation and/or its
 7 affiliates. Other names may be trademarks of their respective
 8 owners.
 9 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
10 mysql>
 1 mysql> show databases;
 2 +--------------------+
 3 | Database           |
 4 +--------------------+
 5 | information_schema |
 6 | itcastoa0720       |
 7 | kingoa             |
 8 | mysql              |
 9 | performance_schema |
10 | qin                |
11 | student            |
12 | test               |
13 +--------------------+
14 8 rows in set (0.01 sec)
15 
16 mysql> use mysql
17 Database changed
18 mysql> show tables;
19 +---------------------------+
20 | Tables_in_mysql           |
21 +---------------------------+
22 | columns_priv              |
23 | db                        |
24 | event                     |
25 | func                      |
26 | general_log               |
27 | help_category             |
28 | help_keyword              |
29 | help_relation             |
30 | help_topic                |
31 | host                      |
32 | ndb_binlog_index          |
33 | plugin                    |
34 | proc                      |
35 | procs_priv                |
36 | proxies_priv              |
37 | servers                   |
38 | slow_log                  |
39 | tables_priv               |
40 | time_zone                 |
41 | time_zone_leap_second     |
42 | time_zone_name            |
43 | time_zone_transition      |
44 | time_zone_transition_type |
45 | user                      |
46 +---------------------------+
47 24 rows in set (0.01 sec)
48 
49 mysql> select user,host,password from user;
50 +------+-----------+-------------------------------------------+
51 | user | host      | password                                  |
52 +------+-----------+-------------------------------------------+
53 | root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
54 +------+-----------+-------------------------------------------+
55 1 row in set (0.00 sec)
56 
57 mysql> update user set password=password('123456') where user='root' and host='l
58 ocalhost';
59 Query OK, 1 row affected (0.00 sec)
60 Rows matched: 1  Changed: 1  Warnings: 0
61 
62 mysql> select user,host,password from user;
63 +------+-----------+-------------------------------------------+
64 | user | host      | password                                  |
65 +------+-----------+-------------------------------------------+
66 | root | localhost | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
67 +------+-----------+-------------------------------------------+
68 1 row in set (0.00 sec)
69 
70 mysql>

重新打开一个cmd命令窗口,测试

 1 C:\Users\Administrator>mysql -u root -p123456
 2 Welcome to the MySQL monitor.  Commands end with ; or \g.
 3 Your MySQL connection id is 7
 4 Server version: 5.5.40 MySQL Community Server (GPL)
 5 
 6 Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
 7 
 8 Oracle is a registered trademark of Oracle Corporation and/or its
 9 affiliates. Other names may be trademarks of their respective
10 owners.
11 
12 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
13 
14 mysql>

 

posted @ 2018-10-28 20:08  浪漫De刺猬  阅读(1137)  评论(1编辑  收藏  举报