1、cmd进入命令行,切换到mysql的安装目录(本机mysql安装路径D:\MySQL)
C:\Documents and Settings\Administrator>d:
D:\>cd D:\MySQL\MySQL Server 5.0\bin
D:\MySQL\MySQL Server 5.0\bin>dir
驱动器 D 中的卷是 新加卷
卷的序列号是 923D-971E
D:\MySQL\MySQL Server 5.0\bin 的目录
2010-01-12 15:44 <DIR> .
2010-01-12 15:44 <DIR> ..
2006-05-26 04:50 1,196,032 comp-err.exe
2006-05-26 04:50 1,470,464 libmySQL.dll
2006-05-26 04:50 1,433,600 myisamchk.exe
2006-05-26 04:50 1,339,392 myisamlog.exe
2006-05-26 04:50 1,351,680 myisampack.exe
2006-05-26 04:50 1,314,816 myisam_ftdump.exe
2006-05-26 04:50 1,572,864 mysql.exe
2006-05-26 04:50 1,437,696 mysqladmin.exe
2006-05-26 04:50 1,454,080 mysqlbinlog.exe
2006-05-26 04:50 1,425,408 mysqlcheck.exe
2006-05-26 04:50 6,680,576 mysqld-debug.exe
2006-05-26 04:50 4,648,960 mysqld-max-nt.exe
2006-05-26 04:50 4,644,864 mysqld-max.exe
2006-05-26 04:50 4,149,248 mysqld-nt.exe
2006-05-26 04:50 4,149,248 mysqld.exe
2006-05-26 04:50 1,466,368 mysqldump.exe
2006-05-26 04:50 1,429,504 mysqlimport.exe
2006-04-19 04:41 1,561,600 MySQLInstanceConfig.exe
2006-05-26 04:50 1,470,464 mysqlmanager.exe
2006-05-26 04:50 1,429,504 mysqlshow.exe
2006-05-26 04:50 1,527,808 mysqltest.exe
2006-05-26 04:50 1,761,280 mysql_client_test.exe
2006-05-26 04:50 1,191,936 my_print_defaults.exe
2006-05-26 04:50 1,171,456 perror.exe
2006-05-26 04:50 1,187,840 replace.exe
25 个文件 52,466,688 字节
2 个目录 23,282,192,384 可用字节
D:\MySQL\MySQL Server 5.0\bin>mysqld-nt –skip-grant-tables
2、cmd打开另一个命令行窗口
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>mysql -uroot -p
Enter password:(这里提示输入密码直接回车即可)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.22-community-nt
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> update mysql.user set password=password(‘admin’) where user=’root’;(修改root用户密码)
Query OK, 2 rows affected (0.09 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.16 sec)
mysql> exit;
Bye
win7/win8使用管理员权限运行 kill mysqld进程
C:\Documents and Settings\Administrator>net start mysql
MySQL 服务已经启动成功。
C:\Documents and Settings\Administrator>net stop mysql
没有启动 MySQL 服务。
请键入 NET HELPMSG 3521 以获得更多的帮助。
C:\Documents and Settings\Administrator>net helpmsg 3521
没有启动 *** 服务。
C:\Documents and Settings\Administrator>net start mysql
MySQL 服务已经启动成功。