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

相关推荐
东风破_14 小时前
从输入 juejin.cn 到看到页面:DNS、Nginx、服务器集群与 CDN 到底在做什么?
后端·mysql
小成很成14 小时前
mysql 8.0.21 升级 mysql 8.0.45(经过生产环境验证)
android·mysql·adb
东风破_14 小时前
从 0 设计一个博客数据库:用户、头像与文章表应该怎么建?
后端·mysql
大模型码小白16 小时前
Spring AI Tool 实现自然语言操作 MySQL 数据库详解
服务器·开发语言·数据库·人工智能·python·mysql·spring
云计算DevOps-韩老师18 小时前
【MySQL运维DBA】【SQL基础系列002篇】
运维·mysql·dba
放风铃的兔子18 小时前
15 年 DBA 经验:MySQL 迁移到 KES,哪些东西真的不用改?
mysql
动力 continue20 小时前
MySQL 基础篇 · SELECT 查询大
数据库·sql·mysql·select
程序员-Benothing20 小时前
MySQL 索引下推是什么?——深入理解 ICP 原理与实践
android·数据库·mysql
JavaPub-rodert1 天前
Ontop 详解:不搬数据库,也能把 MySQL / PostgreSQL 变成知识图谱
数据库·mysql·postgresql
一路向北finish1 天前
《CentOS7 OpenStack Mitaka 全栈部署实战:双节点搭建全流程与典型故障排坑指南》
运维·mysql·serverless·云计算·openstack