今天我講到的重置root密碼與以往有的不同了,下面我介紹在windows下使用mysql.exe加載一個txt文件來修改mysql root密碼。
1.首先在C盤我們創(chuàng)建一個txt文檔將其重命名為"mysql-init.txt",文檔內(nèi)容我們輸入
update mysql.user set password=password('newpasswd') where user='root';
flush privileges;注:其中 newpasswd 可以更改為您需要重置的Mysql密碼
2.點(diǎn)擊開始→運(yùn)行→CMD,進(jìn)入CMD命令行,首先輸入 net stop mysql 停止數(shù)據(jù)庫服務(wù).
然后進(jìn)入Mysql安裝目錄下的bin目錄,以下圖片為Mysql安裝目錄在C:/Mysql/mysql Server5.1/bin
3.輸入命令mysqld --init-file=C://mysql-init.txt 回車
4.密碼重置成功,再次在CMD命令行中輸入 net start mysql 啟動數(shù)據(jù)庫服務(wù)
新聞熱點(diǎn)
疑難解答
圖片精選