忘记mysql的root用户密码详细解决方法Word下载.docx
《忘记mysql的root用户密码详细解决方法Word下载.docx》由会员分享,可在线阅读,更多相关《忘记mysql的root用户密码详细解决方法Word下载.docx(8页珍藏版)》请在冰豆网上搜索。
![忘记mysql的root用户密码详细解决方法Word下载.docx](https://file1.bdocx.com/fileroot1/2022-11/28/60e099aa-3973-4192-aaf2-84a6f00ec23d/60e099aa-3973-4192-aaf2-84a6f00ec23d1.gif)
如:
===============================================================================
\ProgramFiles\MySQL\MySQLServer5.1\bin>
1103019:
20:
07[Warning]'
--default-character-set'
isdeprecatedandwillberemovedinafuturerelease.Pleaseuse'
--character-set-server'
instead.
07[Note]Plugin'
FEDERATED'
isdisabled.
07InnoDB:
Initializingbufferpool,size=46.0M
Completedinitializationofbufferpool
Started;
logsequencenumber044233
07[Note]mysqld:
readyforconnections.
Version:
'
5.1.55-community'
socket:
'
port:
3306MySQLCommunityServer(GPL)
2、打开第二个cmd窗口,连接mysql:
输入命令:
mysql-uroot-p
出现:
Enterpassword:
在这里直接回车,不用输入密码。
然后就就会出现登录成功的信息,
WelcometotheMySQLmonitor.Commandsendwith;
or\g.
YourMySQLconnectionidis3
Serverversion:
5.1.55-communityMySQLCommunityServer(GPL)
Copyright(c)2000,2010,Oracleand/oritsaffiliates.Allrightsreserved.
ThissoftwarecomeswithABSOLUTELYNOWARRANTY.Thisisfreesoftware,
andyouarewelcometomodifyandredistributeitundertheGPLv2license
Type'
help;
or'
\h'
forhelp.Type'
\c'
toclearthecurrentinputstatement.
mysql>
使用命令:
showdatabases;
显示已有数据库:
+--------------------+
|Database|
|information_schema|
|mysql|
|test|
3rowsinset(0.00sec)
使用命令切换到mysql数据库:
usemysql;
使用命令更改root密码:
UPDATEuserSETPassword=PASSWORD('
newpassword'
)whereUSER='
root'
;
刷新权限:
FLUSHPRIVILEGES;
然后退出,重新登录:
quit
重新登录:
出现输入密码提示,输入新的密码即可登录:
***********
显示登录信息:
YourMySQLconnectionidis9
到这里root密码就已经修改成功了,用Ctrl+C将第一个cmd窗口结束,那样就会停止mysql服务,如:
===============================================================================C:
\ProgramF
iles\MySQL\MySQLServer5.1\my.ini"
11030110:
29:
47[Warning]'
isdeprecatedandwillbere
movedinafuturerelease.Pleaseuse'
47[Note]Plugin'
47InnoDB:
48InnoDB:
48[Note]mysqld:
(此处输入ctrl+c)
30:
58[Note]mysqld:
Normalshutdown
58InnoDB:
Startingshutdown...
31:
03InnoDB:
Shutdowncompleted;
03[Note]mysqld:
Shutdowncomplete
Mysql服务停止了,输入命令:
netstartmysql,即可重新启动mysql服务,如:
netstartmysql
MySQL服务正在启动.
MySQL服务已经启动成功。
全部流程的操作信息,如下:
停止mysql服务方法1:
停止mysql服务方法2:
停止mysql服务方法3:
第一个CMD窗口:
第二个CMD窗口:
MicrosoftWindowsXP[版本5.1.2600]
(C)版权所有1985-2001MicrosoftCorp.
\DocumentsandSettings\Administrator>
showdatabases;
usemysql;
Databasechanged
UPDATEuserSETPassword=PASSWORD('
QueryOK,2rowsaffected(0.03sec)
Rowsmatched:
2Changed:
2Warnings:
0
FLUSHPRIVILEGES;
QueryOK,0rowsaffected(0.00sec)
quit
Bye
结束第一个窗口,输入ctrl+c命令停止mysql服务:
重新启动mysql服务: