参考: 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 实际环境下仍是当心为好!测试