忘记mysql的root用户密码详细解决方法.docx

上传人:b****6 文档编号:4273639 上传时间:2022-11-28 格式:DOCX 页数:8 大小:130.86KB
下载 相关 举报
忘记mysql的root用户密码详细解决方法.docx_第1页
第1页 / 共8页
忘记mysql的root用户密码详细解决方法.docx_第2页
第2页 / 共8页
忘记mysql的root用户密码详细解决方法.docx_第3页
第3页 / 共8页
忘记mysql的root用户密码详细解决方法.docx_第4页
第4页 / 共8页
忘记mysql的root用户密码详细解决方法.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

忘记mysql的root用户密码详细解决方法.docx

《忘记mysql的root用户密码详细解决方法.docx》由会员分享,可在线阅读,更多相关《忘记mysql的root用户密码详细解决方法.docx(8页珍藏版)》请在冰豆网上搜索。

忘记mysql的root用户密码详细解决方法.docx

忘记mysql的root用户密码详细解决方法

mysql忘记root密码的解决方法:

1、首先检查mysql服务是否启动,若已启动则先将其停止服务,可在开始菜单的运行,使用命令:

netstopmysql

或者在windows任务管理器中结束mysqld.exe进程,或者在控制面板,管理工具里面的服务找到mysql,将其停止服务。

打开第一个cmd窗口,切换到mysql的bin目录,运行命令:

mysqld--defaults-file="C:

\ProgramFiles\MySQL\MySQLServer5.1\my.ini"--console--skip-grant-tables

注释:

该命令通过跳过权限安全检查,开启mysql服务,这样连接mysql时,可以不用输入用户密码。

"C:

\ProgramFiles\MySQL\MySQLServer5.1\my.ini"指配置文件my.ini,一般在mysql安装目录里面。

如:

===============================================================================

C:

\ProgramFiles\MySQL\MySQLServer5.1\bin>mysqld--defaults-file="C:

\ProgramFiles\MySQL\MySQLServer5.1\my.ini"--console--skip-grant-tables

1103019:

20:

07[Warning]'--default-character-set'isdeprecatedandwillberemovedinafuturerelease.Pleaseuse'--character-set-server'instead.

1103019:

20:

07[Note]Plugin'FEDERATED'isdisabled.

1103019:

20:

07InnoDB:

Initializingbufferpool,size=46.0M

1103019:

20:

07InnoDB:

Completedinitializationofbufferpool

1103019:

20:

07InnoDB:

Started;logsequencenumber044233

1103019:

20:

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

重新登录:

mysql-uroot-p

出现输入密码提示,输入新的密码即可登录:

Enterpassword:

***********

显示登录信息:

WelcometotheMySQLmonitor.Commandsendwith;or\g.

YourMySQLconnectionidis9

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>

到这里root密码就已经修改成功了,用Ctrl+C将第一个cmd窗口结束,那样就会停止mysql服务,如:

===============================================================================C:

\ProgramFiles\MySQL\MySQLServer5.1\bin>mysqld--defaults-file="C:

\ProgramF

iles\MySQL\MySQLServer5.1\my.ini"--console--skip-grant-tables

11030110:

29:

47[Warning]'--default-character-set'isdeprecatedandwillbere

movedinafuturerelease.Pleaseuse'--character-set-server'instead.

11030110:

29:

47[Note]Plugin'FEDERATED'isdisabled.

11030110:

29:

47InnoDB:

Initializingbufferpool,size=46.0M

11030110:

29:

47InnoDB:

Completedinitializationofbufferpool

11030110:

29:

48InnoDB:

Started;logsequencenumber044233

11030110:

29:

48[Note]mysqld:

readyforconnections.

Version:

'5.1.55-community'socket:

''port:

3306MySQLCommunityServer(GPL)

(此处输入ctrl+c)

11030110:

30:

58[Note]mysqld:

Normalshutdown

11030110:

30:

58InnoDB:

Startingshutdown...

11030110:

31:

03InnoDB:

Shutdowncompleted;logsequencenumber044233

11030110:

31:

03[Note]mysqld:

Shutdowncomplete

Mysql服务停止了,输入命令:

netstartmysql,即可重新启动mysql服务,如:

===============================================================================

C:

\ProgramFiles\MySQL\MySQLServer5.1\bin>netstartmysql

MySQL服务正在启动.

MySQL服务已经启动成功。

C:

\ProgramFiles\MySQL\MySQLServer5.1\bin>

===============================================================================

全部流程的操作信息,如下:

停止mysql服务方法1:

停止mysql服务方法2:

停止mysql服务方法3:

第一个CMD窗口:

===============================================================================

C:

\ProgramFiles\MySQL\MySQLServer5.1\bin>mysqld--defaults-file="C:

\ProgramFiles\MySQL\MySQLServer5.1\my.ini"--console--skip-grant-tables

1103019:

20:

07[Warning]'--default-character-set'isdeprecatedandwillbere

movedinafuturerelease.Pleaseuse'--character-set-server'instead.

1103019:

20:

07[Note]Plugin'FEDERATED'isdisabled.

1103019:

20:

07InnoDB:

Initializingbufferpool,size=46.0M

1103019:

20:

07InnoDB:

Completedinitializationofbufferpool

1103019:

20:

07InnoDB:

Started;logsequencenumber044233

1103019:

20:

07[Note]mysqld:

readyforconnections.

Version:

'5.1.55-community'socket:

''port:

3306MySQLCommunityServer(GPL)

===============================================================================

第二个CMD窗口:

===============================================================================

MicrosoftWindowsXP[版本5.1.2600]

(C)版权所有1985-2001MicrosoftCorp.

C:

\DocumentsandSettings\Administrator>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;

Databasechanged

mysql>UPDATEuserSETPassword=PASSWORD('newpassword')whereUSER='root';

QueryOK,2rowsaffected(0.03sec)

Rowsmatched:

2Changed:

2Warnings:

0

mysql>FLUSHPRIVILEGES;

QueryOK,0rowsaffected(0.00sec)

mysql>quit

Bye

C:

\DocumentsandSettings\Administrator>mysql-uroot-p

Enterpassword:

***********

WelcometotheMySQLmonitor.Commandsendwith;or\g.

YourMySQLconnectionidis9

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>

===============================================================================

结束第一个窗口,输入ctrl+c命令停止mysql服务:

C:

\ProgramFiles\MySQL\MySQLServer5.1\bin>mysqld--defaults-file="C:

\ProgramFiles\MySQL\MySQLServer5.1\my.ini"--console--skip-grant-tables

11030110:

29:

47[Warning]'--default-character-set'isdeprecatedandwillbere

movedinafuturerelease.Pleaseuse'--character-set-server'instead.

11030110:

29:

47[Note]Plugin'FEDERATED'isdisabled.

11030110:

29:

47InnoDB:

Initializingbufferpool,size=46.0M

11030110:

29:

47InnoDB:

Completedinitializationofbufferpool

11030110:

29:

48InnoDB:

Started;logsequencenumber044233

11030110:

29:

48[Note]mysqld:

readyforconnections.

Version:

'5.1.55-community'socket:

''port:

3306MySQLCommunityServer(GPL)

(此处输入ctrl+c)

11030110:

30:

58[Note]mysqld:

Normalshutdown

11030110:

30:

58InnoDB:

Startingshutdown...

11030110:

31:

03InnoDB:

Shutdowncompleted;logsequencenumber044233

11030110:

31:

03[Note]mysqld:

Shutdowncomplete

重新启动mysql服务:

C:

\ProgramFiles\MySQL\MySQLServer5.1\bin>netstartmysql

MySQL服务正在启动.

MySQL服务已经启动成功。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 理化生

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1