gpt4 book ai didi

mysql - Q : MariaDB Installation Problem on Fedora 30

转载 作者:行者123 更新时间:2023-11-30 21:27:21 25 4
gpt4 key购买 nike

我需要安装 MariaDB 并按照官方 Fedora Wiki 说明进行操作,但我无法正确安装。所以,首先我运行 dnf install mariadb mariadb-server 命令(在 root 下),返回的是

Package mysql-community-client-8.0.17-1.fc30.x86_64 is already installed. Package mysql-community-server-8.0.17-1.fc30.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete!

所以我尝试使用 systemctl start mariadb 启用/启动 mariadb 然后返回是

Failed to start mariadb.service: Unit mariadb.service not found.

我安装了其他必要的软件包,如 php、httpd、mysql 等,我也需要安装 LAMP,但我收到了这个 MariaDB 错误。你能给我指路吗?

最佳答案

发生这种情况是因为 mysql-community 包被配置为过时的 mariadb 包。

下面的方法可能不是最优的,每个人都可以轻松地参与简化它。

首先,如果您安装了 mysql-community-* 软件包,您可能已经配置了 MySQL Community 存储库。在你的 /etc/yum.repo.d 中搜索它并从那里删除它:

$ grep -ri community /etc/yum.repos.d/*
/etc/yum.repos.d/mysql.repo:[mysql80-community]
/etc/yum.repos.d/mysql.repo:name=MySQL 8.0 Community Server
/etc/yum.repos.d/mysql.repo:baseurl=http://repo.mysql.com/yum/mysql-8.0-community/fc/$releasever/$basearch/

sudo mv /etc/yum.repos.d/mysql.repo /tmp/

然后,检查你有哪些 mysql-community-* 包:

$ rpm -qa | grep mysql-community
mysql-community-server-8.0.17-1.fc30.x86_64
mysql-community-libs-8.0.17-1.fc30.x86_64
mysql-community-client-8.0.17-1.fc30.x86_64
mysql-community-common-8.0.17-1.fc30.x86_64

摆脱它们的最简单方法就是通过dnf 删除它们。但这需要非常小心完成,因为如果它们已经存在了一段时间,您可能有其他包依赖于它们。因此,当您运行 remove 命令时,请确保您没有有自动是(-y 选项),并检查同意卸载前的输出。它可能看起来像这样:

$ sudo dnf remove mysql-community*
Dependencies resolved.
===================================================================================================================================================================================
Package Architecture Version Repository Size
===================================================================================================================================================================================
Removing:
mysql-community-client x86_64 8.0.17-1.fc30 @mysql80-community 66 M
mysql-community-common x86_64 8.0.17-1.fc30 @mysql80-community 8.3 M
mysql-community-libs x86_64 8.0.17-1.fc30 @mysql80-community 7.5 M
mysql-community-server x86_64 8.0.17-1.fc30 @mysql80-community 128 M
Removing dependent packages:
perl-DBD-MySQL x86_64 4.050-2.fc30 @fedora 367 k
Removing unused dependencies:

请注意 删除依赖包 部分。我只添加了一个包来做一个例子,但在你的情况下,它可能会更长更可怕。如果您确实有该部分并且不知道是否可以安全地删除其所有内容,最好不要这样做(暂时)。中止操作。

Is this ok [y/N]: n
Operation aborted.

相反,您可以尝试用 MariaDB 替换 mysql-community 包。有 dnf 选项 --allowerasing 这似乎可以解决问题,但您需要指定包名称和版本以解决 mysql 过时问题(将命令中的版本替换为实际可用的版本):

$ sudo dnf install --allowerasing --setopt=install_weak_deps=False mariadb-server-10.3.17 mariadb-10.3.17
Last metadata expiration check: 0:07:18 ago on Mon 07 Oct 2019 02:25:32 PM UTC.
Dependencies resolved.
===================================================================================================================================================================================
Package Architecture Version Repository Size
===================================================================================================================================================================================
Installing:
mariadb x86_64 3:10.3.17-1.fc30 updates 5.9 M
mariadb-server x86_64 3:10.3.17-1.fc30 updates 17 M
Installing dependencies:
mariadb-common x86_64 3:10.3.17-1.fc30 updates 36 k
mariadb-connector-c-config noarch 3.1.3-1.fc30 updates 12 k
mariadb-errmsg x86_64 3:10.3.17-1.fc30 updates 205 k
mysql-selinux noarch 1.0.0-8.fc30 fedora 35 k
psmisc x86_64 23.1-5.1.fc30 fedora 133 k
Removing dependent packages:
mysql-community-client x86_64 8.0.17-1.fc30 @mysql80-community 66 M
mysql-community-server x86_64 8.0.17-1.fc30 @mysql80-community 128 M

Transaction Summary

现在除了 mysql-community 之外,没有任何依赖项被删除,这是目标。

选项 --setopt=install_weak_deps=False 不是绝对必要的,但没有它 dnf 会安装许多您可能不需要的包。您可以在没有选项的情况下运行以查看差异。

替换服务器和客户端包后,您可以检查 MySQL 社区服务器还剩下什么,如果需要,请尝试删除剩余的包:

$ rpm -qa | grep mysql-community
mysql-community-libs-8.0.17-1.fc30.x86_64
mysql-community-common-8.0.17-1.fc30.x86_64

$ sudo dnf remove mysql-community-libs mysql-community-common
Dependencies resolved.
===================================================================================================================================================================================
Package Architecture Version Repository Size
===================================================================================================================================================================================
Removing:
mysql-community-common x86_64 8.0.17-1.fc30 @mysql80-community 8.3 M
mysql-community-libs x86_64 8.0.17-1.fc30 @mysql80-community 7.5 M

Transaction Summary

现在看起来很安全,不再有依赖。


我能想到一个问题。 如果您一开始不知道为什么要安装 mysql-community,您可能有一些需要它的东西,并且不会满足于用 MariaDB 替换它。那么它可能不会让你更换包。但我猜不出它可能是什么,所以这取决于你去尝试看看。我想它会出现在您确认之前检查的 dnf 输出中。

关于mysql - Q : MariaDB Installation Problem on Fedora 30,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58248469/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com