在 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 后续版本能在数据库替换友好度上有所改进。

相关推荐
螺蛳粉 螺蛳粉1 天前
MySQL 分布式集群系列 · 第五篇——全方位对比:NDB、MGR、主从复制、分库分表怎么选?
数据库·分布式·mysql
泡泡鱼(敲代码中)1 天前
MySQL 学习笔记:DCL、函数与约束 —— 安全、效率、完整性的三板斧
开发语言·笔记·sql·学习·mysql·gitee
这个DBA有点耶1 天前
从OLTP到OLAP到HTAP:数据库负载分类的技术演进与选型指南
数据库·mysql·架构
何以解忧,唯有..1 天前
MySQL 是如何实现事务隔离的?
mysql
螺蛳粉 螺蛳粉1 天前
mysql备份脚本
mysql
IT大白鼠1 天前
MySQL 高可用系列 · Orchestrator + ProxySQL 第三篇——核心原理精讲
数据库·mysql·架构
国际云,接待1 天前
云服务器跨厂商迁移怎么尽量不停机:用 rsync、MySQL binlog 和 DNS TTL 做双阶段切换
运维·服务器·mysql
小白学大数据1 天前
Python 项目实战:用 Flask 构建生产级 MySQL 增删改查 REST API
开发语言·人工智能·python·mysql·flask
minebmw71 天前
第 02 讲 基础架构:一条 SQL 查询语句是如何执行的?
mysql
jaysee-sjc1 天前
【苍穹外卖】Day01:从零认识企业级项目开发
java·开发语言·数据库·mysql·spring·intellij-idea·mybatis