国产探花免费观看_亚洲丰满少妇自慰呻吟_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窗口關閉,再次打開服務即可。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丹江口市| 镇雄县| 巫山县| 扎兰屯市| 铜梁县| 邹城市| 武清区| 丽江市| 额敏县| 诸暨市| 开平市| 南投县| 清涧县| 涿州市| 定安县| 无锡市| 芜湖市| 偏关县| 塘沽区| 鄄城县| 鄂托克旗| 惠东县| 迭部县| 巨鹿县| 神池县| 封开县| 田林县| 平泉县| 南宫市| 石柱| 渭源县| 屯昌县| 诸暨市| 宁南县| 樟树市| 福泉市| 三原县| 庆城县| 同仁县| 台北县| 商南县|