忘記MySQL數(shù)據(jù)庫密碼,不用愁!
在實(shí)際操作中你是否遇到過忘記MySQL數(shù)據(jù)庫密碼的情況?不用著急我們這篇文章就是這一問題給出的答案,如果你對(duì)其解決方案的實(shí)際操作步驟有興趣了解的話,你就可以通過以下的文章對(duì)其進(jìn)行更好的了解。
破解本地MySQL數(shù)據(jù)庫密碼:
Windows:
1.用系統(tǒng)管理員登陸系統(tǒng)。
2.停止MySQL的服務(wù)。
3.進(jìn)入命令窗口,然后進(jìn)入 MySQL的安裝目錄,比如我的安裝目錄是c:\mysql,進(jìn)入C:\mysql\bin
4.跳過權(quán)限檢查啟動(dòng)MySQL,
c:\mysql\bin>mysqld-nt ––skip-grant-tables
或則:c:\mysql\bin>mysqld ––skip-grant-tables
mysqld.exe是微軟Windows MySQL server數(shù)據(jù)庫服務(wù)器相關(guān)程序。mysqld-nt.exe是MySQL Daemon數(shù)據(jù)庫服務(wù)相關(guān)程序。
5.[未驗(yàn)證]
重新打開一個(gè)窗口
進(jìn)入c:\mysql\bin目錄,設(shè)置root的新MySQL數(shù)據(jù)庫密碼
c:\mysql\bin>mysqladmin -u root flush-privileges password "newpassword"
c:\mysql\bin>mysqladmin -u root -p shutdown
將newpassword替換為你要用的root的密碼,第二個(gè)命令會(huì)提示你輸入新密碼,重復(fù)第一個(gè)命令輸入的密碼。
5.[驗(yàn)證]或則:
重新開打一個(gè)命令提示符的窗口(CMD)
用空密碼方式使用root用戶登錄 MySQL;
mysql -u root
修改root用戶的MySQL數(shù)據(jù)庫密碼;
- mysql> update mysql.user set password=PASSWORD('新密碼') where User='root';
- mysql> flush privileges;
- mysql> quit
6.停止MySQL Server,用正常模式啟動(dòng)Mysql
7.你可以用新的密碼鏈接到Mysql 了。
Unix&Linux:
1.用root或者運(yùn)行mysqld 的用戶登錄系統(tǒng);
2.利用kill命令結(jié)束掉mysqld的進(jìn)程;
3.使用–skip-grant-tables參數(shù)啟動(dòng)MySQL Server
- shell>mysqld_safe –skip-grant-tables &
4.為root@localhost設(shè)置新MySQL數(shù)據(jù)庫密碼
- shell>mysqladmin -u root flush-privileges password "newpassword"
5.重啟MySQL Server
附錄:
MySQL修改密碼的方法大全:
- mysql> update user set Password=password('newpassword') where User='root';
- mysql> flush privileges;
- MYSQLADMIN -u root -p PASSWORD mypasswd
可以修改MYSQL文件夾中的MY.INI文件
- mysql> SET PASSWORD FOR myuser@localhost = PASSWORD('mypasswd');
- mysql> GRANT USAGE ON *.* TO myuser@localhost IDENTIFIED BY 'mypassword';
Tag標(biāo)簽: MySQL忘記密碼,MySQL找回密碼,MySQL數(shù)據(jù)庫密碼,MySQL修改密碼
原文標(biāo)題: MySQL忘記密碼解決方案
連接:http://www.cnblogs.com/visoeclipse/archive/2010/04/06/1705427.html
【編輯推薦】