centos環境下登入mysql報 ERROR 1045 (28000)怎麼解決

來源:互聯網
上載者:User

標籤:sql   href   需要   order   解決   media   upd   ddc   lis   

centos環境下登入mysql報 ERROR 1045 (28000)怎麼解決

新入手一台虛擬機器,Centos7系列的作業系統,安裝mysql後,執行串連出現了Mysql ERROR 1045 (28000):的錯誤。遇到同樣問題的朋友,可以參考如下解決方案。

工具/原料
  • Centos
  • mysql、mariadb
方法/步驟 
  1. 首先使用如下命令停止mysql或者mariadb服務。

    service mariadb stop

  2. 使用mysqld_safe來啟動mysqld伺服器:

    mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

  3. 再次重新登入資料庫,執行如下命令:

    mysql -uroot mysql

  4. 重新設定root的密碼及重新整理許可權。下列SQL語句中,123456為要修改的root密碼,根據自己的需要進行修改即可。

    UPDATE user SET PASSWORD=PASSWORD(‘123456‘) where USER=‘root‘;FLUSH PRIVILEGES;

  5. 再次登入一下,已經可以成功登入了。

    mysql -uroot 

centos環境下登入mysql報 ERROR 1045 (28000)怎麼解決

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.