參考: https://blog.csdn.net/iehadoop/article/details/82961264 http://www.javashuo.com/article/p-vbwddtdh-dq.htmlphp
人家寫的很詳細了,我這裏記錄一下我本身的操做過程html
中止 mysql 服務 sudo service mysql status sudo service mysql stopmysql
查詢 mysql 依賴 :~$ dpkg --list|grep mysqlsql
ii dbconfig-mysql 2.0.9 all dbconfig-common MySQL/MariaDB support ii mysql-client-5.7 5.7.25-0ubuntu0.18.04.2 amd64 MySQL database client binaries ii mysql-client-core-5.7 5.7.25-0ubuntu0.18.04.2 amd64 MySQL database core client binaries ii mysql-common 5.8+1.0.4 all MySQL database common files, e.g. /etc/mysql/my.cnf ii mysql-server 5.7.25-0ubuntu0.18.04.2 all MySQL database server (metapackage depending on the latest version) ii mysql-server-5.7 5.7.25-0ubuntu0.18.04.2 amd64 MySQL database server binaries and system database setup ii mysql-server-core-5.7 5.7.25-0ubuntu0.18.04.2 amd64 MySQL database server binaries ii php-mysql 1:7.2+60ubuntu1 all MySQL module for PHP [default] ii php7.2-mysql 7.2.15-0ubuntu0.18.04.2 amd64 MySQL module for PHP
逐個卸載 sudo apt-get remove mysql-common 出錯了!ubuntu
The following packages have unmet dependencies: dbconfig-mysql : Depends: default-mysql-client but it is not going to be installed or virtual-mysql-client E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
sudo apt-get autoremove --purge mysql-server-5.7 sudo apt-get autoremove --purge mysql-server-core-5.7 sudo apt-get autoremove --purge mysql-client-5.7 sudo apt-get autoremove --purge mysql-client-core-5.7 再來 sudo apt-get remove mysql-commonphp7
清除殘留 dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -Poop
sudo apt autoremove學習
我這裏沒有什麼數據,使用認爲如下必要刪除 sudo rm -rf /etc/mysql/ /var/lib/mysql 實際環境下仍是當心爲好!測試