最近在安裝MySQL時(shí),遇到了第三步安裝失敗的問題,以下是我的經(jīng)驗(yàn)分享:
第一步:重啟電腦
sudo reboot
第二步:檢查MySQL依賴項(xiàng)并升級(jí)
sudo apt-get update sudo apt-get upgrade sudo apt-get install libaio1 libmecab2
第三步:安裝MySQL
sudo dpkg -i mysql*.deb
然而,安裝過程中出現(xiàn)了如下錯(cuò)誤:
mysql@localhost:~$ sudo dpkg -i mysql-server_8.0.15-1ubuntu18.04_amd64.deb [sudo] password for mysql: (Reading database ... 36138 files and directories currently installed.) Preparing to unpack mysql-server_8.0.15-1ubuntu18.04_amd64.deb ... Unpacking mysql-server (8.0.15-1ubuntu18.04) over (8.0.15-1ubuntu18.04) ... Setting up mysql-common (8.0.15-1ubuntu18.04) ... update-alternatives: warning: forcing reinstallation of alternative /etc/mysql/my.cnf because link group my.cnf is broken dpkg: error processing package mysql-common (--install): installed mysql-common package post-installation script subprocess returned error exit status 10 dpkg: dependency problems prevent configuration of mysql-server: mysql-server depends on mysql-common (= 8.0.15-1ubuntu18.04); however: Package mysql-common is not configured yet. dpkg: error processing package mysql-server (--install): dependency problems - leaving unconfigured Errors were encountered while processing: mysql-common mysql-server
通過日志可以看到,原因是更新MySQL common時(shí)出錯(cuò),嘗試卸載該軟件并重新安裝:
sudo apt-get remove mysql-common sudo dpkg -i mysql*.deb
成功解決該問題!
希望這篇文章對(duì)你有幫助!