在 Ubuntu 20.04 上安装 MariaDB 时出现问题

在 Ubuntu 20.04 上安装 MariaDB 时出现问题
root@vmi1433468:~# sudo apt install mariadb-server mariadb-client -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
mariadb-client : Depends: mariadb-client-10.3 (>= 1:10.3.22-1ubuntu1) but it is not going to 
be installed
mariadb-server : Depends: mariadb-server-10.3 (>= 1:10.3.22-1ubuntu1) but it is not going to 
be installed
E: Unable to correct problems, you have held broken packages.

我需要帮助

答案1

您的系统上可能安装了一些 MySQL 软件包。MariaDB 是 MySQL 的替代品,两者使用相同的库名称和文件(在/var/lib/mysql和中/etc/mysql/my.conf)。查看此帖子:为什么 Ubuntu 禁止通过 apt 安装 MySQL 和 MariaDB?更多细节。

使用apt list --installed | grep mysql并寻找mysql-servermysql-client-8.0以及其他类似的包。

如果要安装 MariaDB,则必须卸载这些。您可以逐个手动删除它们,也可以使用apt通配符 ( *),如下所示:

sudo apt remove mysql*
sudo apt autoremove

相关内容