詳解如何在Redhat Linux(CentOS)下重設MySQL根(Root)密碼

來源:互聯網
上載者:User

標籤:mysql root密碼

1.首先輸入“service mysqld status”查看當前mysql服務狀態,顯示正在mysqld服務正在運行中。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/2017070415091576.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" />

2.輸入“killall -TERM mysqld”命令停止所有的mysqld進程。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/20170704150917707.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" />

3.輸入“service mysqld stop”命令停止mysqld服務。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/20170704150919566.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" />

4.輸入“mysqld_safe  --skip-grant-tables &”命令以無密碼方式進入MySQL安全模式。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/20170704150922288.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" style="width:650px;height:auto;" />

5.輸入“mysql -u root”並按斷行符號鍵即可。


6.輸入“use mysql;”掛載資料庫。

注意:請勿忘記在最後輸入分號(;)。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/20170704150926245.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" />

7.輸入"update user set password=password("Redhat") where user=‘root‘"將Root密碼修改為New9ssw0rd。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/20170704150928759.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" style="width:650px;height:auto;" />

8.輸入"flush privileges;"更新許可權。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/20170704150930238.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" />

9.輸入“quit”並按斷行符號鍵退出。

注意:此處不需輸入分號。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/20170704150932981.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" />

10.輸入"service mysqld restart"重啟mysqld服務。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/2017070415093538.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" style="width:650px;height:auto;" />

11.輸入“mysql -u root -p”並按斷行符號鍵提示輸入密碼。

650) this.width=650;" src="http://filesimg.111cn.net/2017/07/04/20170704150937442.png" alt="詳解如何在Linux(CentOS)下重設MySQL根(Root)密碼" />

12.輸入新密碼Redhat並按斷行符號鍵,提示已經成功登入。


詳解如何在Redhat Linux(CentOS)下重設MySQL根(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.