忘记了本地mysql密码应该怎么找回

1.    首先以系统管理员身份登陆系统

2.    打开命令行窗口停止mysql服务

C:\>net stop mysql MySQL 服务正在停止. MySQL 服务已成功停止

 

 

3.mysql的安装路径启动mysql,在bin目录下使用mysqld.exe启动, 在命令行窗口执行:mysqld --skip-grant-tables

这个时候这个CMD窗口应该是什么也不显示,但是已经定住在那里,mysqld已经启动

4. 然后另外打开一个命入令行窗口,执行mysql,此时无需输入密码即可进入。执行如下操作

C:\>mysql    无 需输入密码 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.1-m2-community MySQL Community Server (GPL)   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.   mysql>


 

--这个阶段就可以做mysql的表的数据库密码修改,例如可以执行以下命令
[html] view plaincopyUPDATE user SET Password = password('newpassword') WHERE User = 'root';  FLUSH PRIVILEGES;  这样就完成了密码的修改

5.结束mysqld进程
windows下直接任务管理器强行关闭

6.重新开启mysql服务

C:\>net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功

 

 

7.登陆mysql成功

C:\>mysql -u root –pabc (这里只是证明密码修改成功,这样登陆不安全) Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.1-m2-community MySQL Community Server (GPL)   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

 

 

 

 

密码修改成功

posted @ 2013-12-18 10:27  会飞的鱼001  阅读(579)  评论(0编辑  收藏  举报