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

相关推荐
万亿少女的梦1684 小时前
基于Spring Boot、Vue与MySQL的高校实习信息管理系统设计与实现
spring boot·mysql·vue·权限管理·restful api
范什么特西5 小时前
mysql总结
数据库·mysql
Channing Lewis6 小时前
mysql修改了密码之后,已连接的mysql workbench还能访问吗
数据库·mysql
三8446 小时前
PHP+MariaDB/MySQL搭建 社区论坛
mysql·php·mariadb
qq_212838977 小时前
后端Node.js + MySQL,前端Html+js,Nginx反向代理快速部署WEB项目
前端·mysql·node.js
指剑7 小时前
AWS RDS MySQL 8.0 升级到 8.4 完整操作指南
mysql·云计算·aws
J-Tony1117 小时前
【Redis】 Redis 是单线程还是多线程
服务器·数据库·mysql
linux kernel17 小时前
02:库与表的操作
mysql
wuqingshun3141591 天前
什么是代理模式?一般用在什么场景?
java·mysql·代理模式