查看mysql依赖项
dpkg --list | grep mysql
结果
ii libmysqlclient-dev 5.7.34-0ubun amd64 MySQL database development files ii libmysqlclient20:amd64 5.7.34-0ubun amd64 MySQL database client library ii my 5.7.34-0ubun amd64 MySQL database client binaries ii my 5.7.34-0ubun amd64 MySQL database core client binaries ii mysql-common 5.8+1.0.4 all MySQL database common files, e.g. /etc/mysql ii my 5.7.34-0ubun amd64 MySQL database server binaries and system database setup ii my 5.7.34-0ubun amd64 MySQL database server binaries
卸载mysql-common
sudo apt remove mysql-common
结果:
Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libeven libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libtimedate-perl liburi-perl my my Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: libmysqlclient-dev libmysqlclient20 my mysql-common my 0 upgraded, 0 newly installed, 5 to remove and 64 not upgraded. After this operation, 89.0 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 110572 files and directories currently installed.) Removing libmysqlclient-dev (5.7.34-0ubun) ... Removing libmysqlclient20:amd64 (5.7.34-0ubun) ... Removing my (5.7.34-0ubun) ... update-alternatives: using /etc/mysql.fallback to provide /etc/mysql ) in auto mode Removing my (5.7.34-0ubun) ... Removing mysql-common ) ... Processing triggers for man-db ) ... Processing triggers for libc-bin ) ...
卸载并清除my
sudo apt autoremove --purge my
结果:
Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: libaio1* libcgi-fast-perl* libcgi-pm-perl* libencode-locale-perl* libeven* libfcgi-perl* libhtml-parser-perl* libhtml-tagset-perl* libhtml-template-perl* libhttp-date-perl* libhttp-message-perl* libio-html-perl* liblwp-mediatypes-perl* libtimedate-perl* liburi-perl* my* my* my* 0 upgraded, 0 newly installed, 18 to remove and 64 not upgraded. After this operation, 76.3 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 110321 files and directories currently installed.) Removing my (5.7.34-0ubun) ... Removing my (5.7.34-0ubun) ... Removing libaio1:amd64 ) ... Removing libcgi-fast-perl (1:2.13-1) ... Removing libhtml-template-perl ) ... Removing libcgi-pm-perl ) ... Removing libhttp-message-perl ) ... Removing libencode-locale-perl ) ... Removing libeven:amd64 ) ... Removing libfcgi-perl ) ... Removing libhtml-parser-perl ) ... Removing libhtml-tagset-perl ) ... Removing libhttp-date-perl ) ... Removing libio-html-perl ) ... Removing liblwp-mediatypes-perl ) ... Removing libtimedate-perl ) ... Removing liburi-perl ) ... Processing triggers for man-db ) ... Processing triggers for libc-bin ) ... (Reading database ... 109933 files and directories currently installed.) Purging configuration files for my (5.7.34-0ubun) ... Processing triggers for systemd ) ... Processing triggers for ureadahead ) ...
清除残留数据:
dpkg -l | grep ^rc| awk '{print$2}'| sudo xargs dpkg -P
结果:
(Reading database ... 109919 files and directories currently installed.) Purging configuration files for mysql-common ) ...
检查依赖项:
dpkg --list | grep mysql
为空则删除成功。
继续删除:
sudo apt autoremove --purge mysql-apt-config
结果:
Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package mysql-apt-config
卸载成功!