我的系统建议从 19.04 升级,所以我让它升级,但出现了很多错误。现在 MySQL 无法运行。在终端中运行此命令:
运行:sudodpkg --remove --force-all mysql-community-client libmysqlclient21:amd64 mysql-common mysql-community-client-core
dpkg: mysql-community-client: dependency problems, but removing anyway as you requested:
dbconfig-mysql depends on default-mysql-client | virtual-mysql-client; however:
Package default-mysql-client is not installed.
Package virtual-mysql-client is not installed.
Package mysql-community-client which provides virtual-mysql-client is to be removed.
(Reading database ... 533508 files and directories currently installed.)
Removing mysql-community-client (8.0.18-1ubuntu19.10) ...
dpkg: libmysqlclient21:amd64: dependency problems, but removing anyway as you requested:
libvtk6.3 depends on libmysqlclient21 (>= 8.0.11); however:
Package libmysqlclient21:amd64 is to be removed.
libsnmp30:amd64 depends on libmysqlclient21 (>= 8.0.11).
libqt4-sql-mysql:amd64 depends on libmysqlclient21 (>= 8.0.11).
libgdal20 depends on libmysqlclient21 (>= 8.0.11).
Removing libmysqlclient21:amd64 (8.0.18-1ubuntu19.10) ...
Removing mysql-common (8.0.18-1ubuntu19.10) ...
Removing mysql-community-client-core (8.0.18-1ubuntu19.10) ...
Processing triggers for man-db (2.8.7-3) ...
Processing triggers for libc-bin (2.30-0ubuntu2) ...
然后跑:sudo apt 安装-f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
dbconfig-mysql : Depends: default-mysql-client but it is not installed or
virtual-mysql-client
libgdal20 : Depends: libmysqlclient21 (>= 8.0.11) but it is not installed
libqt4-sql-mysql : Depends: libmysqlclient21 (>= 8.0.11) but it is not installed
libsnmp30 : Depends: libmysqlclient21 (>= 8.0.11) but it is not installed
libvtk6.3 : Depends: libmysqlclient21 (>= 8.0.11) but it is not installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
冉:sudo dpkg --remove --force-all dbconfig-mysql; apt-get 下载 libmysqlclient21; sudo dpkg -i libmysqlclient21.deb;须藤apt安装-f *
dpkg: dbconfig-mysql: dependency problems, but removing anyway as you requested:
phpmyadmin depends on dbconfig-mysql | dbconfig-no-thanks | dbconfig-common (<< 2.0.0); however:
Package dbconfig-mysql is to be removed.
Package dbconfig-no-thanks is not installed.
Version of dbconfig-common on system is 2.0.11ubuntu2.
(Reading database ... 533425 files and directories currently installed.)
Removing dbconfig-mysql (2.0.11ubuntu2) ...
Get:1 http://repo.mysql.com/apt/ubuntu eoan/mysql-8.0 amd64 libmysqlclient21 amd64 8.0.18-1ubuntu19.10 [1,281 kB]
Fetched 1,281 kB in 8s (152 kB/s)
Selecting previously unselected package libmysqlclient21:amd64.
(Reading database ... 533424 files and directories currently installed.)
Preparing to unpack libmysqlclient21_8.0.18-1ubuntu19.10_amd64.deb ...
Unpacking libmysqlclient21:amd64 (8.0.18-1ubuntu19.10) ...
dpkg: dependency problems prevent configuration of libmysqlclient21:amd64:
libmysqlclient21:amd64 depends on mysql-common (>= 8.0.18-1ubuntu19.10); however:
Package mysql-common is not installed.
dpkg: error processing package libmysqlclient21:amd64 (--install):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.30-0ubuntu2) ...
Errors were encountered while processing:
libmysqlclient21:amd64
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
libmysqlclient21 : Depends: mysql-common (>= 8.0.18-1ubuntu19.10)
phpmyadmin : Depends: dbconfig-mysql but it is not installed or
dbconfig-no-thanks but it is not installed or
dbconfig-common (< 2.0.0) but 2.0.11ubuntu2 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
偶尔会出现的另一个错误是:
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.
答案1
来自评论:
删除 MySQL 相关软件包强行使用
dpkg
:sudo dpkg --remove --force-all mysql-server mysql-community-client mysql-common mysql-community-client-core libmysqlclient20 libmysqlclient21 mysql-client mysql-community-server-core mysql-community-server
使用 APT 再次安装 MySQL:
sudo apt install mysql-server
答案2
我sudo apt install mysql-server
先安装,然后安装,这样就修复了这个问题sudo apt install php-mysql
。我知道这很奇怪,但它确实有效。