所以我正在关注这个指导安装 MySQL,但我收到错误,提示预安装 mariadb-client-core-10.3
冲突且依赖项未满足,但我无法安装它们,因为它们依赖于 MySQL。完整日志如下:
$sudo dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb
(Reading database ... 290842 files and directories currently installed.)
Preparing to unpack mysql-common_8.0.19-1ubuntu19.10_amd64.deb ...
Unpacking mysql-common (8.0.19-1ubuntu19.10) over (8.0.19-1ubuntu19.10) ...
dpkg: regarding mysql-community-client_8.0.19-1ubuntu19.10_amd64.deb containing mysql-community-client:
mysql-community-client conflicts with mariadb-client-core-10.3
mariadb-client-core-10.3 (version 1:10.3.22-0ubuntu0.19.10.1) is present and installed.
dpkg: error processing archive mysql-community-client_8.0.19-1ubuntu19.10_amd64.deb (--install):
conflicting packages - not installing mysql-community-client
Selecting previously unselected package mysql-client.
Preparing to unpack mysql-client_8.0.19-1ubuntu19.10_amd64.deb ...
Unpacking mysql-client (8.0.19-1ubuntu19.10) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack mysql-community-server_8.0.19-1ubuntu19.10_amd64.deb ...
Unpacking mysql-community-server (8.0.19-1ubuntu19.10) ...
Selecting previously unselected package mysql-server.
Preparing to unpack mysql-server_8.0.19-1ubuntu19.10_amd64.deb ...
Unpacking mysql-server (8.0.19-1ubuntu19.10) ...
Setting up mysql-common (8.0.19-1ubuntu19.10) ...
dpkg: dependency problems prevent configuration of mysql-client:
mysql-client depends on mysql-community-client (= 8.0.19-1ubuntu19.10); however:
Package mysql-community-client is not installed.
dpkg: error processing package mysql-client (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-community-server:
mysql-community-server depends on mysql-client (= 8.0.19-1ubuntu19.10); however:
Package mysql-client is not configured yet.
mysql-community-server depends on mysql-community-server-core (= 8.0.19-1ubuntu19.10); however:
Package mysql-community-server-core is not installed.
dpkg: error processing package mysql-community-server (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 8.0.19-1ubuntu19.10); however:
Package mysql-community-server is not configured yet.
dpkg: error processing package mysql-server (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-community-client_8.0.19-1ubuntu19.10_amd64.deb
mysql-client
mysql-community-server
mysql-server
$ sudo apt-get remove --purge mariadb-client-core-10.3
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
akonadi-backend-mysql : Depends: mariadb-client-core-10.3 but it is not going to be installed or
virtual-mysql-client-core
mysql-client : Depends: mysql-community-client (= 8.0.19-1ubuntu19.10) but it is not installable
mysql-community-server : Depends: mysql-community-server-core (= 8.0.19-1ubuntu19.10) but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
当我运行时sudo apt-get -f install
,它会询问我删除的权限,因此:
The following packages will be REMOVED:
mysql-client mysql-community-server mysql-server
我该怎么办?谢谢您抽出时间。
答案1
尝试使用 apt 安装 mysql,但首先停止 mariadb 进程:
sudo systemctl stop mariadb
然后继续通过apt安装mysql
sudo apt update
sudo apt install mysql-server
然后运行这个,按照步骤操作
sudo mysql_secure_installation
然后你应该能够登录到mysql shell
mysql -uroot -p
编辑:
您也可以完全删除 mariadb,然后运行命令sudo dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb
。删除 mariadb 的命令
apt remove --purge mariadb mariadb-*
警告:运行此程序可能会删除您的数据库。