此处列出的所有删除 MySQL 的解决方案均失败:
和
这些是我的错误:
$ sudo apt-get purge mysql*
$ sudo apt-get autoremove
$ sudo apt-get autoclean
$ sudo apt-get dist-upgrade
$ sudo apt-get install mysql
$ apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
mysql-server-core-5.7
0 upgraded, 0 newly installed, 1 to remove and 131 not upgraded.
2 not fully installed or removed.
After this operation, 46.2 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 287191 files and directories currently installed.)
Removing mysql-server-core-5.7 (5.7.22-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.22-0ubuntu0.16.04.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-client-5.7:
mysql-client-5.7 depends on mysql-common (>= 5.5); however:
Package mysql-common is not configured yet.
dpkg: error processing package mysql-client-5.7 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-common
mysql-client-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
看起来配置时出现了错误mysql-common
,导致了依赖性问题,导致mysql-client-5.7
无法删除。
配置错误是error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
,所以我自然会尝试通过运行来创建该路径sudo touch /etc/mysql/my.cnf.fallback
运行后将sudo dpkg-reconfigure mysql-common
显示错误是否已解决,如果已解决,则可以使用以下命令删除 mysqlsudo apt-get purge mysql*
如果这没有帮助,请提供这些命令的输出/错误,以便我和其他人可以进一步确定问题。
答案2
解决了:
我的系统上有两个用于 mysql 的架构库。
libmysqlclient20:amd64 libmysqlclient20:i386
我删除了 i386 并且所有问题都解决了。