修改MYSQL root的密码
忘记了笔记本上安装的Mysql的root密码,无法登陆。
这年头密码太多了…
搜索了一些文档,当忘记root密码的时候,可以使用如下方式进行修改,其中需要mysql服务的重起。
1)停止windows服务中的mysql实例
2)使用–skip-grant-tables 参数启动mysql,这种模式下,无需root密码就可以登陆mysql.
mysqld-max-nt –skip-grant-tables
3)登陆mysql,修改密码
C:\Documents and Settings\binzhang>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.27-community-max-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql;
Database changed
mysql> update user set password=password("root") where user="root";
Query OK, 1 row affected (0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 0
4)然后重新启动mysql. 在这里,我不知道如何正常停止–skip-grant-tables起来的mysqld-max-nt 进程,只能杀掉了。
C:\Documents and Settings\binzhang>C:\yongh\pslist.exe
PsList 1.26 - Process Information Lister
Copyright (C) 1999-2004 Mark Russinovich
Sysinternals - www.sysinternals.com
Process information for L-SHB-BINZHANG:
Name Pid Pri Thd Hnd Priv CPU Time Elapsed Time
............................................................................
mysqld-max-nt 2072 8 13 15427 58768 0:00:00.140 0:11:16.016
cmd 1460 8 1 30 2104 0:00:00.040 0:00:03.749
pslist 2828 13 2 82 928 0:00:00.030 0:00:00.020
C:\Documents and Settings\binzhang>C:\yongh\pskill.exe 2072
PsKill v1.11 - Terminates processes on local or remote systems
Copyright (C) 1999-2005 Mark Russinovich
Sysinternals - www.sysinternals.com
Process 2072 killed.
然后mysql -uroot -proot就可以登陆了。



















一点小错误^_^
mysqld-max-nt –skip-grant-tables
这里–skip-grant-tables前面应该是两个短横线