Mysql 找回密码

1,找到安装mysql的位置

      输入cmd:进入mysql bin安装目录

      如:D:\Program Files\MySQL\MySQL Server 5.5\bin>mysqld --skip-grant-tables

      执行如上命令:这个cmd窗口就暂时不动

2.重新打开一个新的命令窗体

     输入cmd进入安装目录bin文件下执行mysql命令

     如:D:\Program Files\MySQL\MySQL Server 5.5\bin>mysql

     输入以下命令:进行修改密码:

    mysql> use mysql
    Database changed
    mysql> update user set password=password("123") where user="root";
    Query OK, 1 row affected (0.05 sec)
    Rows matched: 1  Changed: 1  Warnings: 0

    刷新权限:
   mysql> flush privileges;
    Query OK, 0 rows affected (0.16 sec)

   退出命令窗体

   mysql>  quit;

3.重新进入mysql

D:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -u root -p
Enter password: ***
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.28 MySQL Community Server (GPL)

 

4.备注:

   如果有错,请向在服务中结束mysql ,或者net stop mysql5

 

 

   

posted @ 2014-12-13 22:58  sulin  阅读(159)  评论(0编辑  收藏  举报