1、打开DOS进入mysql下bin目录:本人:C:\Program Files\MySQL\MySQL Server 5.1\bin
2、停止mysql服务,net stop mysql
2、停止mysql服务,net stop
3、在C:\Program Files\MySQL\MySQL Server 5.1\bin后面输入:mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server \my.ini" --console --skip-grant-tables
Version: '5.1.33-community-log' socket: '' port: 3306 MySQL Community Server
(GPL)
4.看到这个结果就说明MySQL已经起来了。
再开一个DOS窗口,同样切到mysql bin目录下,
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.33-community-log MySQL Community Server (GPL)
5.
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;
mysql> FLUSH PRIVILEGES;
mysql> quit