MySQL資料庫忘記root密碼解決方案

來源:互聯網
上載者:User

一、Windows下破解:
1、停止mysql服務
2、進入命令視窗,進入mysql安裝目錄下的bin目錄下,跳過許可權檢測,啟動mysql
mysql\bin>mysqld-nt --skip-grant-tables
3、重新開啟一個視窗,進入bin目錄下,設定新的root密碼
mysql\bin>mysqladmin -u root  flush-privileges password "newpassword"
mysql\bin>mysqladmin -u root -p shutdown 提示你輸入密碼,輸入newpassword進入資料庫
4、停止mysql server,用正常模式啟動mysql,然後用上面帳號就可以登陸資料庫庫了。

二、Linux下破解:
vi /etc/my.cnf# 在裡面添加一行skip-grant-tables # 儲存退出# 重啟mysql服務services mysql restart# 這裡登入mysql就不要求輸入密碼了mysql -uroot -p# 修改mysql的root密碼use mysql;update user set password=password(‘123’)where user='root';# 最後

vi/etc/my.cnf
# 在裡面添加一行
skip-grant-tables
# 儲存退出
# 重啟mysql服務
services mysql restart
# 這裡登入mysql就不要求輸入密碼了
mysql -uroot -p
# 修改mysql的root密碼
use mysql;
update user set password=password(‘123’)where user='root';
# 最後重新整理許可權
flush privileges
quit

Mysql5.0版root密碼忘記的解決方案 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.