解決mysql忘記密碼

2021-06-28 02:12:42 字數 1779 閱讀 8451

mysql有時候忘記密碼了怎麼辦?我給出案例和說明!一下就解決了!

windows下的實際操作如下

1.關閉正在執行的mysql。

2.開啟dos視窗,轉到mysql\bin目錄。

3.輸入mysqld --skip-grant-tables回車。如果沒有出現提示資訊,那就對了。

4.再開乙個dos視窗(因為剛才那個dos視窗已經不能動了),轉到mysql\bin目錄。

5.輸入mysql回車,如果成功,將出現mysql提示符 >

6. 連線許可權資料庫》use mysql; (>是本來就有的提示符,別忘了最後的分號)

6.改密碼:> update user set password=password("520") where user="root"; (別忘了最後的分號)

7.重新整理許可權(必須的步驟)>flush privileges;

8.退出 > \q

9.登出系統,再進入,開mysql,使用使用者名稱root和剛才設定的新密碼123456登陸。

第一步c:\documents and settings\administrator>cd d:\web\www.php100.com\mysql\mysql se

rver5.5\bin

c:\documents and settings\administrator>d:

d:\web\www.php100.com\mysql\mysql server5.5\bin>mysqld --skip-grant-tables

第二步microsoft windows [版本 5.2.3790]

c:\documents and settings\administrator>cd d:\web\www.php100.com\mysql\mysql se

rver5.5\bin

c:\documents and settings\administrator>d:

d:\web\www.php100.com\mysql\mysql server5.5\bin>mysql

welcome to the mysql monitor. commands end with ; or \g.

your mysql connection id is 1

server version: 5.5.10 mysql community server (gpl)

oracle is a registered trademark of oracle corporation and/or its

affiliates. other names may be trademarks of their respective

owners.

type 'help;' or '\h' for help. type '\c' to clear the current input statement.

mysql> use mysql;

database changed

mysql> update user set password=password("520") where user="root";

query ok, 1 row affected (0.00 sec)

rows matched: 1 changed: 1 warnings: 0

mysql> flush privileges;

query ok, 0 rows affected (0.00 sec)

mysql> \q

byed:\web\www.php100.com\mysql\mysql server5.5\bin>

解決mysql忘記密碼

mysql有時候忘記密碼了怎麼辦?我給出案例和說明 一下就解決了 windows下的實際操作如下 1.關閉正在執行的mysql。2.開啟dos視窗,轉到mysql bin目錄。3.輸入mysqld skip grant tables回車。如果沒有出現提示資訊,那就對了。4.再開乙個dos視窗 因為剛...

解決mysql忘記密碼

windows下的實際操作如下 1.關閉正在執行的mysql。2.開啟dos視窗,轉到mysql bin目錄。3.輸入mysqld skip grant tables回車。如果沒有出現提示資訊,那就對了。4.再開乙個dos視窗 因為剛才那個dos視窗已經不能動了 轉到mysql bin目錄。5.輸入...

MySQL忘記密碼解決

1 開啟mysql.exe和mysqld.exe所在的資料夾,複製路徑位址 2 開啟cmd命令提示符,進入上一步mysql.exe所在的資料夾。3 輸入命令 mysqld skip grant tables 回車,此時就跳過了mysql的使用者驗證。注意輸入此命令之後命令列就無法操作了,此時可以再開...