国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

mysql忘記root密碼的解決方法

2019-11-08 20:54:59
字體:
來源:轉載
供稿:網友

好長時間沒有用MySQL了,也忘記了當時的root密碼,看了好幾篇文章,把自己的方法記下。

Windows下的忘記root密碼的解決方法:

1、首先先檢查一下MySql服務有沒有打開。可以命令行里面輸入 taskkill /f /im mysqld-nt.exe 先關閉MySql服務 。或者在計算機->管理>服務和應用程序里面的服務,找到mysql服務關閉。再或者也可在windows的任務管理器里面結束掉mysqld.exe 進程。

2、打開一個cmd窗口,切換到mysql的bin目錄  

C:/PRogram Files/MySQL/MySQL Server 5.5/bin>,運行命令:

mysqld --defaults-file="C:/ProgramData/MySQL/MySQL Server 5.5/my.ini" --console --skip-grant-tables

(這里注意,新版本的mysql的my.ini在ProgramData里面,網上的多數經驗都寫的在program files里)

注釋:

該命令通過跳過權限安全檢查,開啟mysql服務,這樣連接mysql時,可以不用輸入用戶密碼。

"C:/ProgramData/MySQL/MySQL Server 5.5/my.ini"指配置文件my.ini,一般在mysql安裝目錄里面。

如: 見圖1

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

C:/Program Files/MySQL/MySQL Server 5.5/bin>mysqld --defaults-file="C:/ProgramData/MySQL/MySQL Server 5.5/my.ini" --console --skip-grant-tables170208 16:39:51 [Note] mysqld (mysqld 5.5.46-log) starting as process 14276 ...

3、打開第二個cmd窗口,連接mysql: (這里需要說明一下可以輸入命令,也可以直接 開始 - 程序 - mysql server5.5 - MySQL 5.5 Command Line Client)

輸入命令:mysql -uroot -p

出現:

Enter passWord

這里直接回車,不用輸入密碼。然后就會出現登錄成功的信息,

Welcome to the MySQL monitor.  Commands end with ; or /g.Your MySQL connection id is 4Server version: 5.5.46-log MySQL Community Server (GPL)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql>

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

使用命令切換到mysql數據庫

use mysql;

使用命令更改root密碼:

UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

PS:newpassword=你將要修改的密碼

刷新權限:

FLUSH PRIVILEGES;

然后退出,再次登錄:

quit 

重新登錄:

mysql -uroot -p

出現輸入密碼提示,輸入新的密碼即可:

如:

Enter password: ***Welcome to the MySQL monitor.  Commands end with ; or /g.Your MySQL connection id is 4Server version: 5.5.46-log MySQL Community Server (GPL)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql>

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

進行到這里就算修改成功啦。

接下來把cmd窗口關閉,再次打開服務即可。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 紫云| 山东| 民乐县| 郴州市| 炉霍县| 叙永县| 南和县| 长寿区| 淅川县| 酉阳| 砚山县| 林甸县| 东丰县| 定远县| 辰溪县| 寿阳县| 滦南县| 江城| 武安市| 定边县| 山西省| 年辖:市辖区| 正安县| 浦县| 松桃| 江安县| 洛隆县| 儋州市| 那曲县| 礼泉县| 达尔| 公安县| 永年县| 梅州市| 木里| 贺兰县| 安国市| 台湾省| 万荣县| 青浦区| 济阳县|