mysql5.1 重置ROOT密码

1,停掉MYSQL SERVER,如果服务是WIN service, start->control panel->administrative tools->services
2, 创建文本文件
UPDATE mysql.user SET Password=PASSWORD('mysql') WHERE User='root';
FLUSH PRIVILEGES;
保存为 D:\mysql-init.txt
3, 打开CMD,
C:\>"C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysqld.exe" --defaults-file="C:\Program Files (x86)\MySQL\MySQL Server 5.1\my.ini" --init-file=D:\mysql-init.txt

4.服务起来后, 删掉 D:\mysql-init.txt.
现在可以用新密码登录了,停下服务mysqladmin shutdown -u root -p
然后从Win service 启动服务。

English reference:
http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html

你可能感兴趣的:(mysql5)