找回MySQL的root密码

1.
C:\wamp\bin\mysql\mysql5.1.36>cd bin

C:\wamp\bin\mysql\mysql5.1.36\bin>dir
Volume in drive C has no label.
Volume Serial Number is 38DC-C60C

Directory of C:\wamp\bin\mysql\mysql5.1.36\bin

10/22/2009 12:16 PM <DIR> .
10/22/2009 12:16 PM <DIR> ..
06/17/2009 11:18 AM 2,359,296 libmySQL.dll
06/17/2009 11:18 AM 2,089,600 myisamchk.exe
06/17/2009 11:18 AM 1,979,008 myisamlog.exe
06/17/2009 11:18 AM 2,007,680 myisampack.exe
06/17/2009 11:18 AM 1,966,720 myisam_ftdump.exe
06/17/2009 11:18 AM 2,347,648 mysql.exe
06/17/2009 11:18 AM 2,282,112 mysqladmin.exe
06/17/2009 11:18 AM 2,368,128 mysqlbinlog.exe
06/17/2009 11:18 AM 2,278,016 mysqlcheck.exe
06/17/2009 11:18 AM 6,582,912 mysqld.exe
06/17/2009 11:18 AM 2,331,264 mysqldump.exe
06/17/2009 11:18 AM 2,273,920 mysqlimport.exe
02/06/2009 01:17 AM 2,971,776 MySQLInstanceConfig.exe
06/17/2009 11:18 AM 2,273,920 mysqlshow.exe
06/17/2009 11:18 AM 1,802,880 mysql_upgrade.exe
06/17/2009 11:18 AM 1,728,512 my_print_defaults.exe
06/17/2009 11:18 AM 1,716,224 perror.exe
06/17/2009 11:18 AM 1,703,936 resolveip.exe
18 File(s) 43,063,552 bytes
2 Dir(s) 3,049,091,072 bytes free

C:\wamp\bin\mysql\mysql5.1.36\bin>mysqld-nt
'mysqld-nt' is not recognized as an internal or external command,
operable program or batch file.

C:\wamp\bin\mysql\mysql5.1.36\bin>mysqld -nt --skip-grant-tables

//此命令执行后会挂起,此时新开cmd,执行修改密码操作;


2.
update the password
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>cd C:\wamp\bin\mysql\mysql5.1.36

C:\wamp\bin\mysql\mysql5.1.36>cd bin

C:\wamp\bin\mysql\mysql5.1.36\bin>mysql.exe
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

C:\wamp\bin\mysql\mysql5.1.36\bin>
C:\wamp\bin\mysql\mysql5.1.36\bin>mysql.exe
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

//一些方案说直接执行mysql登录后修改密码,我试后行不通;
//直接使用mysqladmin命令修改密码

C:\wamp\bin\mysql\mysql5.1.36\bin>mysqladmin.exe -u root flush-privileges password "111111"

C:\wamp\bin\mysql\mysql5.1.36\bin>mysqladmin -u root -p shutdown
//此命令执行后会要求你输入密码,与以上所设相同即可
Enter password: ******

C:\wamp\bin\mysql\mysql5.1.36\bin>


3.返回第一个窗口,已经自动停止;启动mysql,使用新密码登录,ok。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值