到Dos界面(win+R),切换到你的MySQL bin目录下。 比如我的是 D:\MySQL\bin
然后敲下面的粗体的命令。注意你的my.ini位置。D:\MySQL\bin>mysqld --defaults-file="D:\MySQL\my.ini" --console --skip-grant-tables
由于我没有关闭mysql,导致出现错误
InnoDB: The error means that another program is using InnoDB's files.
InnoDB: This might be a backup or antivirus software or another instance
InnoDB: of MySQL. Please close it to get rid of this error.
那么请关闭mysql(net stop mysql )再运行,则可
150811 22:06:09 [Note] mysqld: ready for connections.
Version: '5.1.33-community-log' socket: '' port: 3306 MySQL Community Server
(GPL)
看到这个结果就说明MySQL已经起来了。
D:\MySQL>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)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
mysql> UPDATE user SET Password=PASSWORD("新密码") where USER="root";
mysql> FLUSH PRIVILEGES;
mysql> quit
之后正常重启MySQL服务就可以啦了。