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密碼忘記的解決方案 

相關文章

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.