在 Rocky Linux 10.1 Minimal 上安装 MySQL 9.7 的血泪史:MariaDB 到底有多“根深蒂固”?

前言

最近想尝试一下最新的 MySQL 9.7 LTS,于是在本地重新安装了 Rocky Linux 10.1 Minimal 版。本以为 Minimal 安装会很干净,结果却被 MariaDB 折腾得死去活来,花了大量时间也没能成功安装 MySQL 9.7,最终选择放弃。

记录一下整个过程,希望能帮到同样踩坑的朋友。

安装环境

  • 系统:Rocky Linux 10.1 Minimal
  • 安装方式:官方 Minimal ISO 干净安装
  • 目标:安装官方 MySQL Community Server 9.7.1

安装过程与问题

  1. 系统安装完成后,第一时间执行了 dnf update -y 并重启。

  2. 按照官方文档添加 MySQL Yum 仓库:

    Bash

    sql 复制代码
    sudo dnf install -y https://dev.mysql.com/get/mysql84-community-release-el10-3.noarch.rpm
  3. 尝试安装 MySQL 9.7:

    Bash

    vbscript 复制代码
    sudo dnf install -y mysql-community-server mysql-community-client

然后就遇到了漫长的冲突地狱:

错误核心是各种文件冲突:

  • /usr/bin/mysql
  • /usr/bin/mysqldump
  • /usr/sbin/mysqld
  • /var/lib/mysql
  • 等等......

冲突来源:

  • mariadb11.8 系列包(Rocky Linux 10 默认 AppStream 组件)
  • 后来还发现了 mysql8.4(Rocky 自带版本)
text 复制代码
Running transaction check
Transaction check succeeded.
Running transaction test
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Transaction test error:
  file /usr/bin/mysql conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/bin/mysqladmin conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/bin/mysqlbinlog conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/bin/mysqlcheck conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/bin/mysqldump conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/bin/mysqlimport conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/bin/mysqlshow conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/bin/mysqlslap conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/share/man/man1/mysql.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/share/man/man1/mysqladmin.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/share/man/man1/mysqlbinlog.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/share/man/man1/mysqlcheck.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/share/man/man1/mysqldump.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/share/man/man1/mysqlimport.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/share/man/man1/mysqlshow.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/share/man/man1/mysqlslap.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
  file /usr/bin/innochecksum conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/bin/my_print_defaults conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-3:11.8.8-1.el10_2.x86_64
  file /usr/bin/myisam_ftdump conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/bin/myisamchk conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/bin/myisamlog conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/bin/myisampack conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/bin/mysql_secure_installation conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/bin/mysql_tzinfo_to_sql conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-3:11.8.8-1.el10_2.x86_64
  file /usr/bin/mysqldumpslow conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-client-utils-3:11.8.8-1.el10_2.noarch
  file /usr/bin/perror conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/lib/systemd/system/mysqld.service conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/sbin/mysqld conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/innochecksum.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/my_print_defaults.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/myisam_ftdump.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/myisamchk.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/myisamlog.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/myisampack.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/mysql_secure_installation.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/mysql_tzinfo_to_sql.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man1/mysqldumpslow.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-client-utils-3:11.8.8-1.el10_2.noarch
  file /usr/share/man/man1/perror.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /usr/share/man/man8/mysqld.8.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
  file /var/lib/mysql conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64

尝试过的清理手段

我先后尝试了以下方法(多次重复):

  • dnf remove --allowerasing mariadb* MariaDB* mysql*
  • dnf module disable mariadb mysql
  • 手动删除 /etc/my.cnf*、/var/lib/mysql*、/usr/bin/mysql* 等目录
  • 重装系统后立即清理(Minimal 版)
  • 使用 --allowerasing 强制安装

结果依然失败,MariaDB 的文件残留得非常顽固。

总结与建议

Rocky Linux 10(包括 AlmaLinux 10、RHEL 10)在数据库替换上确实做得不够友好。MariaDB 被深度集成进了系统,即使是 Minimal 安装,也很难彻底移除。

给同样想在 Rocky Linux 10 上用 MySQL 9.7 的朋友的建议:

  1. 如果不是必须使用 Rocky,强烈推荐 Ubuntu 24.04,安装 MySQL 体验好太多。
  2. 使用 Docker 运行官方 MySQL 镜像(最干净的方式)。
  3. 考虑直接使用 PostgreSQL + pgvector(向量搜索场景下体验更好)。
  4. 或者直接上云数据库,避免本地这些麻烦事。

后记

本以为 Minimal 安装会很清爽,结果还是被系统默认组件坑了。希望 Rocky Linux 后续版本能在数据库替换友好度上有所改进。

相关推荐
闲云野鹤在人间16 小时前
MySQL|从理论、安装、备份到主从复制、MHA高可用详解
linux·运维·数据库·mysql·云计算
要开心吖ZSH18 小时前
MySQL 慢 SQL 排查操作手册-个人笔记版
java·笔记·sql·mysql·慢查询
Gl�ria20 小时前
MySQL 单机版 vs 高可用版:宕机排查 + 故障处理
mysql·adb·架构
Titan202420 小时前
MySQL索引学习笔记
笔记·学习·mysql
ClouGence21 小时前
数据库迁移工具 CloudCanal v6.5.0.0 发布:新增 TDSQL PostgreSQL 多条链路,支持 MongoDB 双向同步
数据库·mysql·mongodb
这个DBA有点耶1 天前
Change Buffer深入:二级索引写入的隐形加速器与它的代价
数据库·mysql·代码规范
for_ever_love__1 天前
MySQL 事务隔离级别讲透:MVCC、幻读与四个级别怎么选
java·数据库·mysql·事务·mvcc·不可重复读·幻读
这个DBA有点耶1 天前
关系数据库管理系统选型指南:四步决策框架与主流产品技术路线对比
数据库·sql·程序人生·mysql·database·dba
我不会起名字3221 天前
MVCC 快照读为什么读不到刚提交的数据:ReadView 的 4 条可见性规则
数据库·mysql·innodb·mvcc·事务隔离
螺蛳粉 螺蛳粉1 天前
第四篇:Keepalived + MySQL 主从高可用实战
数据库·mysql·adb·keepalived·高可用