RSS
热门关键字:
当前位置 :| 主页>美工设计>WEB标准>

windows下的忘记MYSQL密码的重设办法

来源:网络 作者:佚名 时间:2008-08-26 Tag: 点击:
windows下的忘记MYSQL密码的重设办法
时间: 2006-10-24 13:06:33 浏览:1099 
引用:

Windows:  
1.用系统管理员登陆系统。  
2.停止MySQL的服务。  
3.进入命令窗口,然后进入MySQL的安装目录,比如我的安装目录是c:mysql,进入C:mysqlbin  
4.跳过权限检查启动MySQL,  
c:mysqlbin>mysqld-nt --skip-grant-tables  
5.重新打开一个窗口,进入c:mysqlbin目录,设置root的新密码  
c:mysqlbin>mysqladmin -u root flush-privileges password "newpassword"  
c:mysqlbin>mysqladmin -u root -p shutdown  
将newpassword替换为你要用的root的密码,第二个命令会提示你输入新密码,重复第一个命令输入的密码。  
6.停止MySQL Server,用正常模式启动Mysql  
7.你可以用新的密码链接到Mysql了。  


按照说明一步一步来可以执行,但是最后新的密码不管用,重启MYSQL,不行.重启服务器,还是不行!所以请教了很多人,学到了下面的重设密码的办法!

用安全模式启动之后按照文章内的步骤修改,


引用
C:\mysql\bin>mysql  -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.0.15-nt

Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the buffer.

mysql> update user set password=password(''root'') where user=''root'';
ERROR 1046: No Database Selected
mysql> use mysql
Database changed
mysql> select host,user from user;
+-----------+------+
| host      | user |
+-----------+------+
| %         |      |
| %         | root |
| localhost |      |
| localhost | root |
+-----------+------+
4 rows in set (0.02 sec)

mysql> update user set password=password(''root'') where user=''root'';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)

mysql> quit
Bye

C:\mysql\bin>mysql  -uroot
ERROR 1045: Access denied for user: ''root@localhost'' (Using password: NO)

C:\mysql\bin>mysql  -uroot -proot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.0.15-nt

Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the buffer.

mysql> quit
Bye

C:\mysql\bin>

原来root没有密码,后来改成为root了,注意:我直接修改了两个root的密码,可以根据host不同分别修改,忘记密码也可以用这个办法重设!

上一篇:Oracle密码文件的创建、使用和维护
下一篇:没有了
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册