Ubuntu重裝mysql錯誤解決

來源:互聯網
上載者:User

標籤:mysql   system   src   rect   很多   bubuko   伺服器   dep   mysql安裝   

新搭建的伺服器,先在Ubuntu上安裝mariadb,後來由於很多許可權問題,決定安裝Mysql,在卸載過程中由於未卸載乾淨,導致mysql重裝過程中出現了很多問題。

Reading package lists...DoneBuilding dependency treeReading state information ... Donemysql-server is already the newest version(5.7.21-0ubuntu0.16.04.1).You might want to run ‘apt-get -f install‘ to correct these:The following packages have unmet dependencies:mysql-server: depends: mysql-server-5.7 but it is not going to be installedE: Unmet dependencies.Try ‘apt-get -f install‘ with no packages(or specify a solution).

通過閱讀錯誤資訊可知,主要是因為依賴關係出現問題,主要思路是重建依賴關係,然後乾淨卸載,最後重裝。

首先,更新系統

sudo apt-get update

然後,修複安裝錯誤,會提示輸入mysql使用者名稱密碼

sudo apt-get --fix-broken install

然後,檢索mysql安裝包,並刪除檢索出的依賴包,然後是刪除/var/lib/mysql,最後重裝mysql。

下面我把檢索到的解決方案展示給大家:

We excute the following commands to solve the above problem:    1.Get the list of MySQL packages installed on the system by executing the command sudo dpkg -l grep mysql    2.Remove the packages shown above by executing the command       sudo apt-get --purge autoremove <packages from the step 1>    3. Delete /var/lib/mysql    4.Try to install mysql again.It should solve your problem.

第二步中的packages如所示:

最後就是更新系統並重裝mysql

sudo apt-get updatesudo apt-get install mysql-server mysql-client

 總結:

整體思路還是重建依賴關係,乾淨卸載,更新安裝。希望對遇到相同問題不知所措的小夥伴有所啟發、協助。謝謝。

Ubuntu重裝mysql錯誤解決

聯繫我們

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